after update, Invalid hook call error
old project use: dependencies": { "@patternfly/react-core": "^3.153.3", "@patternfly/react-icons": "^3.15.16", "@patternfly/react-styles": "^3.7.12", "@patternfly/react-table": "^2.28.29", "react": "^16.13.1", "react-router-dom": "^5.1.2" } throws an error on many items after an upgrade: Error: 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:
- You might have mismatching versions of React and the renderer (such as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
I also reproduced the error in a new project: npm init npm install @patternfly/react-core --save create-react-app test
package.json: { "name": "test", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo "Error: no test specified" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "@patternfly/react-core": "^4.106.2" } }
index.js:
import React from 'react';
import ReactDOM from 'react-dom';
import {Button} from '@patternfly/react-core';
ReactDOM.render(
<React.StrictMode>
</React.StrictMode>,
document.getElementById('root')
);

I tested it on another machine, and I could not reproduce the problem. After a short investigation, I realised that there is system and a user npm and nodejs installed. Removing the local version solved the problem. The ticket can be closed.
Thank you for verifying that. I will close the issue.