We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
这个是因为在index.js中,外层使用了StrictMode包裹。 在开发模式下,如果使用了严格模式,React会调用两次生命周期。把StrictMode去掉就好了
index.js
StrictMode
React
// index.js import React, { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import App from './App'; const rootElement = document.getElementById('root'); const root = createRoot(rootElement); root.render(<App />);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
这个是因为在
index.js
中,外层使用了StrictMode
包裹。在开发模式下,如果使用了严格模式,
React
会调用两次生命周期。把StrictMode
去掉就好了The text was updated successfully, but these errors were encountered: