Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invariant Violation: Minified React error #307 #15010

Closed
Damdias opened this issue Mar 4, 2019 · 6 comments
Closed

Invariant Violation: Minified React error #307 #15010

Damdias opened this issue Mar 4, 2019 · 6 comments

Comments

@Damdias
Copy link

Damdias commented Mar 4, 2019

I am getting below error when try host app with production build, I have used new React Hooks.

Invariant Violation: Minified React error #307; visit https://reactjs.org/docs/error-decoder.html?invariant=307 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.

@tiendo1011
Copy link

Follow these may help you in chasing the error root cause out: https://reactjs.org/warnings/invalid-hook-call-warning.html

@gaearon
Copy link
Collaborator

gaearon commented Mar 5, 2019

Have you tried following the links? Hope this helps.

clicking on a link

@gaearon gaearon closed this as completed Mar 5, 2019
@gaearon
Copy link
Collaborator

gaearon commented Mar 5, 2019

(The final URL that describes possible causes is: https://reactjs.org/warnings/invalid-hook-call-warning.html)

@TaylorPzreal
Copy link

TaylorPzreal commented Dec 18, 2019

一般是因为你的项目的react版本,低于使用的第三方库依赖的react的版本造成的,可以将工作项目的react版本升级,或降低依赖库的react版本。

The reason maybe you use multi react version, you should ensure your project code use the react version is more than other library react version.

@deligent-ant
Copy link

i have did as your said, just like . " aside of making React and react-dom peer deependencies in your libraries package.json, you also should mark them as 'externals' when building them with webpack"
but the #321 still exist,who can help me.

"peerDependencies": {
    "antd": "^3.25.0",
    "styled-components": "^4.4.1",
    "react": "^16.11.0",
    "react-dom": "^16.11.0"
  }
 externals: [
    // nodeExternals(),
    {
      react: {
        root: 'React',
        commonjs2: 'react',
        commonjs: 'react',
        amd: 'react'
      },
      'react-dom': {
        root: 'ReactDOM',
        commonjs2: 'react-dom',
        commonjs: 'react-dom',
        amd: 'react-dom'
      }
    }
}

if i don't use useCallback ant useMemo ,it can work,but i need useMemo...

@phinguyen202
Copy link

Should be reopened. This still occur on v16.8.2.
I figure out that when using webpack to bundle, the line to declare useState threw an error, for instance:
var _b=(0,react.useState)(0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants