Methods and Rendering in React

You have to reset some state when a prop changes using the getDerivedStateFromProps(). However, you observe that this make your code verbose.

Which of these steps should you take to avoid this?

Options
  1. Make the component fully controlled or fully uncontrolled with a key
  2. Use componentDidUpdate lifecycle
  3. Use a memoization helper
  4. Make the child components to re-render
Previous PostNext Post

Related Posts