I'm working on a react project and we are using react starter kit. I am new to the project and when I clone the project from github and start the project using npm start
it start the server but in web inspector I get following error.
Uncaught Error: imports[1] for react-transform-catch-errors does not look like a React component.
People who already working in the project doesn't get this error. But when I ask from one friend to get a new clone and do the same thing I did he also got the same error.
I don't know what details need to post so if anybody need more details please ask.
Our class component should also have at least three methods: A static method called getDerivedStateFromError , which is used to update the error boundary's state. A componentDidCatch lifecycle method for performing operations when our error boundaries catch an error, such as logging to an error logging service.
With the new feature in React, developers can test the Error Boundaries by a toggle error button, added to the DevTools. When we click on the toggle error button on the component labeled 'Inner Component', Error boundary is triggered.
In order to use Error Boundary in Functional Component, I use react-error-boundary. When we run this application, we will get a nice error display form the content of ErrorHandler component. React error boundary catches any error from the components below them in the tree.
A display of a beautiful UI (HTML and CSS) instead if error when something broke in the code. Example as below. FALLBACK UI SCREEN.
Finally I found the solution... this is due to version mismatch. I don't have a technical explanation. I found three packages in package json related to this problem
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.1",
"redbox-react": "^1.1.1",
so what I did was removed the ^
which download the latest version. Also removed already installed node-modules
folder and ran npm cache clear
.
After that I ran npm install
and the issue gone. I'm a happy lad :D
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With