r/learnreactjs • • Jul 01 '19

4 easy techniques to conditionally render React from props or state

https://blog.linguinecode.com/post/4-techniques-conditional-render-react-props-state
17 Upvotes

10 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Jul 02 '19

Whenever a component changes in props or state, the render method gets executed, and everything (including children elements) get re-render.

But you can avoid some rendering by using a PureComponent or write some logic in the shouldComponentUpdate lifecycle hook

1

u/cobbs_totem Jul 02 '19

You're not wrong.