Engrain by ByteRush

RCT.12.05 Mid-levelCore — asked often

useInterval, useTimeout, useEventListener, useClickOutside

Comes up in: React, Coding

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • latest callback ref pattern (or useEffectEvent)
  • pausing with null delay
  • listener cleanup
  • outside click with portals

Words you will know

—

What you will practise

  • implement 4 hooks

Interview questions this answers

  • Implement useInterval that always calls the latest callback.
  • Implement useClickOutside.