Skip to content

Instantly share code, notes, and snippets.

@trblackw
Created May 31, 2020 19:45
Show Gist options
  • Save trblackw/0c668aceaf5d87ab36c0a6fd30977fc3 to your computer and use it in GitHub Desktop.
Save trblackw/0c668aceaf5d87ab36c0a6fd30977fc3 to your computer and use it in GitHub Desktop.
const initialFormState = {
email: "",
password: "",
valid: false,
}
function Form() {
const [form, setForm] = useState(initialFormState)
//when updating the password field
setForm(prevState => ({ ...prevState, password: "password123" }))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment