Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactcontrolled vs uncontrolledSingle-choice MCQ

A developer writes a controlled file input: `<input type="file" value={fileName} onChange={...} />`. At runtime the page throws or React errors. What is the underlying reason file inputs cannot be controlled this way?

const [fileName, setFileName] = useState(''); <input type="file" value={fileName} onChange={(e) => setFileName(e.target.value)} />