I was using react-spring v8, following along the docs for Parallax when I ran into this issue and kept reading:
@azizhk The current v9 beta exports the renderprops API from
react-spring(no/renderpropsrequired), andreact-spring/webis identical toreact-spring, so you should be able to do:import { Spring } from 'react-spring/web.cjs'Not sure what the solution for v8 is. I'm not contributing to it.
_Originally posted by @aleclarson in https://github.com/react-spring/react-spring/issues/601#issuecomment-560515705_
So I decided to try rc.3. My parallax looks like this:
<Parallax pages={1} scrolling={true}>
<ParallaxLayer offset={0}><Content></ParallaxLayer>
</Parallax>
and my import statement: import { Parallax, ParallaxLayer } from 'react-spring'
But on yarn dev I get the following error:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
I've ruled out other causes because it compiles when I comment out Parallax. Looks like I need to pass in a prop that used to be optional...should I be passing in the ref prop? Next.js v9.4.4 on Node 14.4.0
Update: I resolved it by using react-spring/addons.cjs on react-spring v7.2.8
Reopening so I remember to fix this in v9
Most helpful comment
Reopening so I remember to fix this in v9