Q. How do you ensure a component only mounts once with a side-effect?
β
Correct Answer: (B)
Use useEffect with an empty array
Explanation: Using `useEffect(() => {}, [])` ensures the side-effect runs only once.