Question · Vibe coding with Claude Code course · Module 10: TikTok clone

Stale state in the interval

Why will the condition if (isRecording && ...) in the recorder's interval never stop the recording?

Answer options

  • setInterval cannot call other functions of the component
  • isRecording changes only after the build
  • The function in setInterval remembers isRecording from the moment of start, which is false
  • MediaRecorder ignores a stop() called from an interval

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