Created
July 14, 2020 04:14
-
-
Save tcaer/14a21d20d03dbc5c9b3a03679e19ec1c 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 from 'react'; | |
import { useRecoilState } from 'recoil'; | |
import { someTextState } from './state.js'; | |
function SomeComponent() { | |
const [someText, setSomeText] = useRecoilState(someTextState); | |
const onChange = (event) => { | |
setSomeText(event.target.value); | |
}; | |
return ( | |
<div> | |
<input type='text' value={someText} onChange={onChange} /> | |
Text: {someText} | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment