Started having this issue when I upgraded to Remix v2.
How to reproduce:
- Create new Remix app:
npx create-remix@latest - Install react-player:
npm i react-player - Replace root.tsx with the example from the docs (https://github.com/cookpete/react-player)
import ReactPlayer from 'react-player'
export default function Index() {
return (
<div>
<ReactPlayer url='https://www.youtube.com/watch?v=LXb3EKWsInQ' />
</div>
);
}
When I run it I'm getting this error:
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
However if I call it like this <ReactPlayer.default /> instead of <ReactPlayer /> (I don't even know how I found this out), then it works. Any ideas?
import ReactPlayer from 'react-player'
export default function Index() {
return (
<div>
<ReactPlayer.default url='https://www.youtube.com/watch?v=LXb3EKWsInQ' />
</div>
);
}
I'm a typescript noob so I'm not sure what's going on here. Thanks!