This solution is generated by ChatGPT, correctness is not guaranteed. You might also be able to find a solution fromcommunity posts.
AI solution for React Quiz on BFE.dev
10. useLayoutEffect()
The code outputs the following:
- "App" (logged once when the component mounts)
- "useEffect 1" (logged once when the component mounts)
- "useLayoutEffect" (logged once when the component mounts)
- "useEffect 2" (logged once when the component mounts)
- "useEffect 1 cleanup" (logged when the component unmounts)
- "useEffect 2 cleanup" (logged when the component unmounts)
- "useLayoutEffect cleanup" (logged when the component unmounts)