小编Nir*_*anJ的帖子

警告:使用 react-bootstrap Navbar 时,在 StrictMode 中不推荐使用 findDOMNode

我尝试在打字稿模板中使用 react-bootstrap 的 Navbar 组件,我在 Chrome 控制台中发现了以下警告。

index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference.
    in div (created by Context.Consumer)
    in Transition (created by Collapse)
    in Collapse (created by Context.Consumer)
    in NavbarCollapse (at NavigationBar.tsx:10)
    in nav (created by Navbar)
    in Navbar (at NavigationBar.tsx:7)
    in NavigationBar (at App.tsx:8)
    in div (at App.tsx:7)
    in App (at src/index.tsx:10)
    in StrictMode (at …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs react-bootstrap

14
推荐指数
1
解决办法
2万
查看次数

标签 统计

react-bootstrap ×1

reactjs ×1

typescript ×1