Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useSpring not working #148

Closed
mickaelchanrion opened this issue Sep 8, 2023 · 0 comments · Fixed by #181
Closed

useSpring not working #148

mickaelchanrion opened this issue Sep 8, 2023 · 0 comments · Fixed by #181
Labels
bug Something isn't working

Comments

@mickaelchanrion
Copy link

Hello,
It seems like useSpring is not working. Or at least, not working like the documentation is describing it. Is it up to date?

Check this minimal setup: https://stackblitz.com/edit/github-2k6bjv?file=nuxt.config.ts,app.vue

Also, it's not visible in stackblitz but on my vscode, this very code is screaming like never regarding typings (which I only get if I import explicitly @vueuse/motion in the .vue component, otherwise the function is not typed).

image

After some digging in the source code, I understand the v2 expects more something like this (no typescript error this way):

const box = ref<HTMLElement>()
const scale = ref(0)
const spring = useSpring({ scale: scale.value }, { target: box })

function scaleUp() {
  spring.set({ scale: 2 })
}

But even this doesn't work and the reactivity seems to get lost as this template doesn't get updated:

<pre>{{ scale }}</pre>

I need help please! 🙏

@BobbieGoede BobbieGoede added the bug Something isn't working label Feb 23, 2024
timpulver pushed a commit to timpulver/motion that referenced this issue Apr 1, 2024
The old example was not working, due to a change in the useSpring API and was therefore replaced.
This new example shows a complete Vue component and therefore lowers the barrier to using useSpring.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants