react中使用create-react-app创建项目执行函数两次

React在严格模式下会执行两次render以帮助检查额外的副作用

官网链接:
https://reactjs.org/docs/strict-mode.html

使用create-react-app创建的项目,默认会有

StrictMode,删掉就好了

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_42535651/article/details/108517690
今日推荐