This is my first time working with this package, so I'm not sure if this is a bug or I'm doing something wrong? Removing the useSpring function clears the error. It's also worth noting that I'm using NextJs.
https://codesandbox.io/s/687004x5n
The error
Unhandled Rejection (TypeError): React.useRef is not a function
index.js
import { useSpring, animated } from "react-spring";
export default () => {
const props = useSpring({ opacity: 1, from: { opacity: 0 } })
return <animated.div style={props}>I will fade in</animated.div>
}
package.json
{
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "^7.0.2",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-spring": "^8.0.2"
}
}
you need to use react 16.8.0 (which introduces hooks). i will make this more obvious in the docs, sorry for the confusion. the peer-dependency is set, though, did it warn you in the installation?
Just ran into this issue, but yes, there is a warning in the installation.

Most helpful comment
you need to use react 16.8.0 (which introduces hooks). i will make this more obvious in the docs, sorry for the confusion. the peer-dependency is set, though, did it warn you in the installation?