A

Admin • 833.24K Points
Coach

Q. How do you update state in a class component?

  • (A) By calling this.setState()
  • (B) By assigning directly to this.state
  • (C) By calling setState() without this
  • (D) By using useState hook
  • Correct Answer - Option(A)
  • Views: 25
  • Filed under category React JS
  • Hashtags:

Explanation by: Admin

State updates in class components must be done using this.setState.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.