Q. What will happen if you call `setState` inside `render()`?

  • (A) It will update state as usual
  • (B) It will cause an infinite loop
  • (C) It will throw an error
  • (D) It will do nothing
πŸ’¬ Discuss
βœ… Correct Answer: (B) It will cause an infinite loop
Explanation: Calling `setState` inside `render()` leads to infinite re-renders.
Explanation by: Mr. Dubey
Calling `setState` inside `render()` leads to infinite re-renders.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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