Skip to content

Instantly share code, notes, and snippets.

@kivircik-parantez
Last active December 30, 2022 07:29
Show Gist options
  • Save kivircik-parantez/4f8fd68c004f489da22b39ef9d4f825a to your computer and use it in GitHub Desktop.
Save kivircik-parantez/4f8fd68c004f489da22b39ef9d4f825a to your computer and use it in GitHub Desktop.
Updating state based on props or state
function Form() {
const [firstName, setFirstName] = useState('Taylor');
const [lastName, setLastName] = useState('Swift');
// ✅ Good: calculated during rendering
const fullName = firstName + ' ' + lastName;
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment