Wednesday, October 12, 2016

React State and Props compared

Not much blabla today, just a table that compares the differences between React's props and state.



Props State
Owner parent component component itself
Accessibility public, i.e. inside and outside the component private, only available inside the component
Changeable by parents yes no
Changeable by component itself no yes
Change mechanism parent changes prop component calls this.setState(newState)
Change triggers re-rendering of component yes yes

No comments:

Post a Comment