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

A controlled input is rendered as `<input value={value} onChange={...} />` where `value` is `null` on the first render. React behaves differently than if `value` had been `undefined`. What does passing `value={null}` do here?

const [value, setValue] = useState(null); // not '' <input value={value} onChange={(e) => setValue(e.target.value)} />