Created
January 20, 2020 17:53
-
-
Save EdwardGoomba/dc69ae7755dacd82ad26b43dcb9635ce to your computer and use it in GitHub Desktop.
React Use State Hook w / Handle Change for 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
// example of stateless functional component using useState hooks | |
// example of multi use handleChange function implemented with hooks | |
const StatelessHandleChange = () => { | |
const [scheduleData, setScheduleData] = useState({ | |
firstName: '', | |
lastName: '', | |
dob: '', | |
payer: '', | |
provider: '', | |
startTime: '', | |
endTime: '', | |
}); | |
const handleChange = (event) => { | |
setScheduleData({ [event.target.name]: event.target.value }); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment