stateis managed by a state management library like Redux.
props. Use these components when you need to build “intelligent” React components that are aware of their own
stateas well as the
stateof their children.
statecan not be passed to them from a parent (unless it’s through
props) thus the component cannot update
state. Stateless Function’s can handle props as a destructured object as a parameter.
stateof child components use a Stateless Function. They have a low re-render cost and provide for cleaner code.
shouldComponentUpdatelifecycle method is altered to perform a shallow comparison of what changed in
statesince the last render.
state, a component should become “pure” when theres no need to re-render the entire component (or its children) every time data changes. You can also use PureComponents if you’re building a stateless component, but still need lifecycle methods. Examples would include: TodoLists, Star Ratings, Event Calendars, Forms, Comments
<elem></elem>syntax everywhere else
“for”attribute is written as