A

Admin • 833.24K Points
Coach

Q. What will happen if a hook is used inside a conditional statement?

  • (A) It will work fine
  • (B) React will ignore it
  • (C) React will throw an error
  • (D) It will be skipped on first render
  • Correct Answer - Option(C)
  • Views: 27
  • Filed under category React JS
  • Hashtags:

Explanation by: Admin

Hooks must be called unconditionally at the top level of a function component.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.