react ts 中 ‘React‘ is declared but its value is never read / Vscode 配置

  • Post author:
  • Post category:其他


修改tsconfig.json 中的配置 为false "noUnusedLocals": false, // 有未使用的变量时,抛出错误

VSCode 关闭  右侧缩略图 、 小地图

File -> Preferences -> settings -> User -> Text Editor -> MiniMap -> enable -> 取消勾选即可

问题二:Can’t perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.

解决: 由于请求是异步的没有 方法上 加 async 导致同步的更新 state



版权声明:本文为weixin_42247563原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。