DEV Community

Discussion on: Handle 'componentWillReceiveProps' deprecation warning

Collapse
 
wolverineks profile image
Kevin Sullivan

Any downsides to putting this directly in the render?

...
return props.items.map(doSomething).map(...)
...
Collapse
 
marcostreng profile image
Marco Streng

If there is no need to write the items into the state this would of course be the best solution.

useEffect() gets relevant if you need the data in the state because it can be changed through user interactions for example.