ReactNative Day5

2022年1月3日图

State of Component

React Components can have local state. This state is not shared with the component's parent or the component's child by default. It is fully owned and controlled by the component itself.只是自己拥有并且控制 ⌒by组件自己

▲function和extend方式的区别之一

Remember when we looked at different ways of creating React component in the first page of this tutorial, we said there are things that component extending React.Component can do that a function component cannot do? Well state is one of them. React.Component can have states but function cannot have states.

posted @ 2022-01-03 13:58  Indullged  阅读(14)  评论(0编辑  收藏  举报