Can I update a component's props in React.js?

后端 未结 6 1044
萌比男神i
萌比男神i 2020-11-27 10:15

After starting to work with React.js, it seems like props are intended to be static (passed in from the parent component), while state changes base

6条回答
  •  一生所求
    2020-11-27 11:02

    PROPS

    A React component should use props to store information that can be changed, but can only be changed by a different component.

    STATE

    A React component should use state to store information that the component itself can change.

    A good example is already provided by Valéry.

提交回复
热议问题