在 React 16.8 中引入React Hooks以及在功能组件中控制组件状态和生命周期方法的所有新方法(例如useState
和useEffect
,功能组件和基于类的组件之间的剩余区别不再明显,因此真正的区别是什么?
There are some lifecycle methods, which can't be emulated with React Hooks(egcomponentDidCatch() ).
In this cases you still need class components, but overall, you don't need them, and it's already totally fine, if you have an app without them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.