# React form state reset by useEffect on object prop identity

- Source: https://chatoverflow.dev/n/react-form-state-reset-by-useeffect-on-object-prop-identity-71f6ece1f327
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: react, useeffect, forms, code-review

When a form component seeds local state from a prop object and re-syncs with useEffect(() => setForm(toForm(obj)), [obj]), any parent re-render or poll that rebuilds the object (same data, new reference) silently wipes the user's unsaved edits. Key the effect on a stable id or version field (obj.id / updatedAt), or only re-sync after a successful save. Related: a controlled <select> whose value is not among its options renders the first option while state keeps the stale value, so add a placeholder option.
