Put in order · Vibe coding with Claude Code course · Module 4: Instagram clone

Sorting: Debounce in an event handler

Order the lines of the handleChange function with debounce (top to bottom):

Items to put in order

  • router.replace(phrase ? ... : pathname);
  • if (timer.current) clearTimeout(timer.current);
  • timer.current = setTimeout(() => {
  • }, 300);
  • const phrase = value.trim();

You can check the correct answer by solving this task in the CodeWorlds game.