passing a simple value to parent from a child component in react code example

Example 1: pass element from child to parent react

Parent:

<div className="col-sm-9">
     <SelectLanguage onSelectLanguage={this.handleLanguage} /> 
</div>

Child:

handleLangChange = () => {
    var lang = this.dropdown.value;
    this.props.onSelectLanguage(lang);            
}

Example 2: how to pass props from child to parent

class ToDoList extends React.Component {    constructor(props) {        super(props);        this.state = {            listDataFromChild: null        };        },    myCallback = (dataFromChild) => {        this.setState({ listDataFromChild: dataFromChild });    },    otherFn = () => {        [...within this other function now I still have access to this.state.listDataFromChild...]    }    render() {        return (            <div>                 <ToDoItem callbackFromParent={this.myCallback}/>                 [...now here I can pass this.state.listDataFromChild as a prop to any other child component...]                   </div>        );    }});