Question · Vibe coding with Claude Code course · Module 3: Twitter clone

The file field is uncontrolled

Why is the <input type="file"> field always uncontrolled?

Answer options

  • Because the value of a file field cannot be set from a script, only the user chooses it
  • Because a file field does not accept the ref attribute
  • Because the chosen files are always held by state from useState
  • Because React reads files only on the server

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