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
πŸ’¬ Discuss
βœ… Correct Answer: (C) React will throw an error
Explanation: Hooks must be called unconditionally at the top level of a function component.
Explanation by: Mr. Dubey
Hooks must be called unconditionally at the top level of a function component.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
70
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
99%
Success Rate