DEV Community

Discussion on: How to Force Re-Render a React Component & Should you do it?

marilyannrandall profile image

React automatically Re-Renders the components whenever any of its props ... we should really force a re-render or let React take care of it. Signs Of Black Magic Done On You

ruppysuppy profile image
Tapajyoti Bose Author • Edited on

That's exactly what I pointed out: React re-renders a component when the state data changes. If the props contains a state data from the parent component, a re-rendered is triggered for it too, else it fails to re-render. The fix for it is provided above too & there is no need to force a re-render

Try out the code provided in the example to see for yourself