- ...including Breaking Changes: https://github.com/facebook/create-react-app/releases/tag/v4.0.0
yarn add --exact [email protected]
yarn add react react-dom
yarn add @types/react @types/react-dom
yarn add typescript
yarn add @testing-library/jest-dom @testing-library/react @testing-library/user-event @types/jest
- Add
"noFallthroughCasesInSwitch": true
tocompilerOptions
- background: facebook/create-react-app#9429
- An included external library had both
react
andreact-dom
specified as dependency, causing problems with the Hooks API (https://reactjs.org/warnings/invalid-hook-call-warning.html#mismatching-versions-of-react-and-react-dom). - "Fixed" it by specifying a resolution policy in
package.json
:
"resolutions": {
"lib-that-causes-trouble/react": "^17.0.1",
"lib-that-causes-trouble/react-dom": "^17.0.1"
}
- of course "real" fix would be either upgrading the library to React 17 or (even better) if the lib would add React as
peerDependency
instead ofdependency