A

Admin • 831.35K Points
Coach

Q. How do you prevent a component from re-rendering in React?

  • (A) By returning null in render
  • (B) By using React.memo
  • (C) By avoiding JSX
  • (D) By not using useState
  • Correct Answer - Option(B)
  • Views: 23
  • Filed under category React JS
  • Hashtags:

Explanation by: Admin
React.memo is a higher-order component that prevents re-rendering if props do not change.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.