ReactJS state vs prop

后端 未结 6 1074
予麋鹿
予麋鹿 2021-01-29 17:59

This may be treading that line between answerable and opinionated, but I\'m going back and forth as to how to structure a ReactJS component as complexity grows and could use som

6条回答
  •  天命终不由人
    2021-01-29 18:36

    Updating 2016: React is changed, and explanation "props vs state" became very simple. If a component needs to change data - put it in a state, otherwise in props. Because props are read-only now.

    What's the exact difference between props and state?

    You can find good explanation here (full version)

    Changing props and state

提交回复
热议问题