Uncaught Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:1. You might have mismatching versions of React and the renderer(such as React DOM)2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
In order for Hooks to work, the react import from your application code needs to resolve to the same module as the react import from inside the react-dom package.
// Add this in node_modules/react-dom/index.jswindow.React1 =require('react');// Add this in your component filerequire('react-dom');window.React2 =require('react');console.log(window.React1 === window.React2);