Last active
February 3, 2021 03:10
-
-
Save LuisHCK/fe0e51ea12f03335ce8219b1c0b7f5e6 to your computer and use it in GitHub Desktop.
Revisions
-
LuisHCK revised this gist
Feb 3, 2021 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -23,8 +23,13 @@ export default function Parent() { import React from 'react' export default function ChildrenComponent(props) { const handleChange = (event) => { props.onChange(event.target.value) } return ( <select onChange={handleChange}> <option value="0">Cero</option> <option value="1">Uno</option> </select> -
LuisHCK renamed this gist
Feb 3, 2021 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
LuisHCK created this gist
Feb 3, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ # Parent.js ```js import React from 'react' export default function Parent() { const [myState, setMyState] = useState() return ( <div> <ChildComponent onChange={setMyState} /> <p> {myState} </p> </div> ) } ``` # Children Component ```js import React from 'react' export default function ChildrenComponent(props) { return ( <select onChange={props.onChange}> <option value="0">Cero</option> <option value="1">Uno</option> </select> ) } ```