What will be the output of the following functional component?
const HelloWorld = () => {
const [text, setText] = useState("Hello");
useEffect(() => {
setText("World");
}, []);
return <div>{text}</div>;
};
export default HelloWorld;
Hello
World
Error: Invalid state update
undefined
This question is part of this quiz :
Functional Components