I'm currently learning React hooks and encountered an issue where my component keeps re-rendering infinitely.
I expected the effect to run only once after updating the state, but instead the component continuously re-renders.
Here is a simplified example:
const [data, setData] = useState(null);
useEffect(() => {
setData("hello");
}, [data]);