Q. How do you update the state in React functional components?

  • (A) Using the setter function returned by useState
  • (B) Directly assigning to the state variable
  • (C) Using this.setState()
  • (D) Using useEffect
πŸ’¬ Discuss
βœ… Correct Answer: (A) Using the setter function returned by useState
Explanation: useState returns a state variable and a function to update it.
Explanation by: Mr. Dubey
useState returns a state variable and a function to update it.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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