【发布时间】:2019-04-10 12:32:34
【问题描述】:
我听说严格模式有助于以最佳实践方式编写 React 代码,它会在生命周期方法删除时发出警告。
我从https://medium.com/@baphemot/whats-new-in-react-16-3-d2c9b7b6193b读到了它
我的理解正确吗?严格模式的效果如何?仅适用于不安全的生命周期方法吗?如果没有,我可以在功能组件中使用此功能吗?
import { StrictMode} from “react”;
class Test extends Component{
render(
<StrictMode>
//Some other child component which has all lifecycle methods implemented in it
</StrictMode>
);
}
【问题讨论】:
标签: javascript reactjs react-native