Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 reactjs reactjs

Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321


One reason could be you are importing useEffect from the wrong place (probably the IDE did it)

Wrong

import {useEffect} from "react/cjs/react.production.min";

OK

import React, {useEffect} from 'react';


Got the same error when there is an incompatible react version applied in the runtime. Had to change react and react-dom versions in the main package.json file.

"dependencies": {  "react": "^17.0.2",  "react-dom": "^17.0.2",  ... }


I had the same error, but when using rollup. I solved it by moving react and react-dom to peerDependencies in package.json

  "peerDependencies": {    "react": "^17.0.2",    "react-dom": "^17.0.2"  },