Last active
July 18, 2022 16:01
-
-
Save Yamo93/10f27daf625925e2c80ea51c57bc12bb 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
function Parent () { | |
function save (text) { | |
server.save(text); // save text on server | |
} | |
return <Window onSave={(text) => save(text)}} />; | |
} | |
function Window ({ onSave }) { | |
const [text, setText] = useState(''); | |
return <div> | |
<label>Text:</label> | |
<input type="text" value={text} onChange={(e) => setText(e.target.value)} /> | |
<button onClick={() => onSave(text)}>Save</button> | |
</div>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment