React-Spring app throws "export 'useSpring' (imported as 'useSpring') was not found in 'react-spring'"

Viewed 31

I started to study React-Spring. But I can't solve one problem.

  1. I used npm install react-spring.
  2. then, I copied most simple code in react-spring homepage.
import { useSpring, animated } from 'react-spring'

function App() {

  const props = useSpring({ to: { opacity: 1 }, from: { opacity: 0 } })
  
return <animated.div style={props}>I will fade in</animated.div>

}
  1. This error occurs.

export 'useSpring' (imported as 'useSpring') was not found in 'react-spring' (possible exports: a, animated)

0 Answers
Related