Q. What will happen if you update the state directly without using setState in a class component?

  • (A) The component will not re-render
  • (B) The component will re-render
  • (C) It will throw an error
  • (D) State will be reset
πŸ’¬ Discuss
βœ… Correct Answer: (A) The component will not re-render
Explanation: Directly modifying state does not trigger a re-render; setState should be used.
Explanation by: Mr. Dubey
Directly modifying state does not trigger a re-render; setState should be used.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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