react-player
react-player copied to clipboard
TypeError: init is not a function
Be sure to search for your issue before opening a new one.
Hello, I'm not sure what's going on, but the component simply isn't working in my create-react-app
setup. I tried uninstalling and reinstalling all node_modules as well.
Current Behavior
- React is erroring whenever I try to use
ReactPlayer
- I am using it like so
import React from "react";
import ReactPlayer from "react-player";
import Box from "@material-ui/core/Box";
export default function Playground() {
return (
<Box>
<ReactPlayer url="https://www.youtube.com/watch?v=iB2RT-hyD58" />
</Box>
);
}
And receiving this error
Expected Behavior
- I expected the component to work
Steps to Reproduce
- I simply installed the package, imported it into a component, and it fails.
Environment
- URL attempting to play: see code snippet above
- Browser: Firefox 90.0b3
- Operating system: MacOS 11.2.3 (20D91)
-
"react-player": "^2.9.0"
(Create React App) -
React: 16.13.1
Other Information
Same problem but in Windows with React 16.12.0. I tried with the last version 17.0.2 and it worked. So, the version 16.6 that is told on the migration guide I think is incorrect.
遇到同样的问题
这样的配置能够运行。
但是
这样的配置就会报错:
The implementation of React.lazy has changed. React16.13 has no init property,but React16.14 and React17 has init property.
my workaround for this is to fork the repo and update the react version to latest npm install react@latest react-dom@latest
build by running npm run prepublishOnly
and install by npm install directory-to-repo