1

I am unable to make the simplest example of react-spring work:

import { useSpring } from 'react-spring/three'

export const myComponent = () => {
    const [spring, setSpring] = useSpring(() => ({ xpos: 0 }))
    setSpring({xpos: 10})

    return (
        <Canvas />
    )
}

It gives me this:

Uncaught TypeError: setSpring is not a function

Zamadhi Eturu
  • 131
  • 2
  • 10

2 Answers2

2

There's more discussion on this here: https://github.com/pmndrs/react-spring/issues/1359

Current work-around: use setSpring.current[0].start() rather than setSpring()

Jack Damon
  • 301
  • 1
  • 5
  • 15
0

Well, it works with react-spring v9.0.0 beta.

Zamadhi Eturu
  • 131
  • 2
  • 10