Skip to content

Instantly share code, notes, and snippets.

@tcaer
Created July 14, 2020 04:14
Show Gist options
  • Save tcaer/14a21d20d03dbc5c9b3a03679e19ec1c to your computer and use it in GitHub Desktop.
Save tcaer/14a21d20d03dbc5c9b3a03679e19ec1c to your computer and use it in GitHub Desktop.
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