Last active
December 30, 2022 07:29
-
-
Save kivircik-parantez/4f8fd68c004f489da22b39ef9d4f825a to your computer and use it in GitHub Desktop.
Updating state based on props or state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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