当前位置 : 主页 > 网页制作 > React >

What is state and props

来源:互联网 收集:自由互联 发布时间:2021-06-15
State, in React component, is internal dataset which affects the rendering of the component. To some extent state can be considered as the private data or data model of React components. React component state is mutable. Once the internal s

 

State, in React component, is internal dataset which affects the rendering of the component. To some extent state can be considered as the private data or data model of React components.

React component state is mutable. Once the internal state of a React component is changed, the component will re-render itself according to the new state.

Props, which is short for properties, are properties of React component. Props look like HTML attributes. Values of props in a React component are commonly passed from the parent component.

Props are just passed into, so props are immutale in the eyes of the child components and shouldn‘t be changed directly by the child components.

 

 

https://www.codevoila.com/post/55/reactjs-tutorial-state-and-props

网友评论