AI

useEffect runs after the browser paints. If you manipulate the DOM (like positioning a tooltip) inside it, the user might see a flicker or jump. useLayoutEffect runs before paint.

Your Task:

  • Fix the Tooltip component where the tooltip flickers briefly at (0,0) before jumping to the correct position
  • Change useEffect to useLayoutEffect to block painting until the position is calculated
TypeScript Solution
Loading...

Submit your code to see test results