ReactJS - Does render get called any time "setState" is called?
@lebyy▲ 0 net votes
Problem: Does React re-render all components and sub components every time setState() is called? If so, why? I thought the idea was that React only rendered as little as needed - when state changed. In the following simple example, both classes render again when the… Fix (from the top answer): Does React re-render all components and sub-components every time setState is called? By default - yes. There is a method boolean shouldComponentUpdate(object nextProps, object nextState) , each component has this method and it's responsible to determine "should component update (run render function)?" every time you…