Created
September 4, 2020 14:44
-
-
Save manashcse11/3add5df62313bd632e77061fb09b7759 to your computer and use it in GitHub Desktop.
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
import React, { useContext } from 'react'; | |
import { UserContext } from '../UserContext'; | |
const UpdateContextData = () => { | |
const user = useContext(UserContext); | |
return ( | |
<div> | |
<h3>Update context data</h3> | |
<div className="form-group"> | |
<label>Name</label> | |
<input type="text" className="form-control" value={user.name} onChange={e => user.setName(e.target.value)} /> | |
</div> | |
<div className="form-group"> | |
<label>Profession</label> | |
<input type="text" className="form-control" value={user.profession} onChange={e => user.setProfession(e.target.value)} /> | |
</div> | |
</div> | |
); | |
}; | |
export default UpdateContextData; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment