Q. How do you pass data from a child component to a parent component in React?

  • (A) By passing a callback function from the parent to the child and invoking it with data
  • (B) By using props directly from the child
  • (C) By using the Context API only
  • (D) By modifying the parent's state directly
πŸ’¬ Discuss
βœ… Correct Answer: (A) By passing a callback function from the parent to the child and invoking it with data
Explanation: Data flows down via props; child can send data up via callbacks.
Explanation by: Mr. Dubey
Data flows down via props; child can send data up via callbacks.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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