In React, I am trying to send a JavaScript object from a parent component to a child component, but I also want the changes to that object in the child component to be visible in the parent component. I am trying to use the concept of props but it doesn't seem to work. What could be wrong here?
So basically:
class ParentComponent extends React.Component {
   constructor(){}
   render() {
   return <ChildComponent exampleObject={"Example"}> </ChildComponent>
             }
}
class ChildComponent extends React.Component {
   constructor (props) {
   super();
   this.state={myState: props.exampleObject}
                     }
render() {
   this.state.myState="Example 2";
   console.log(this.state.myState);
   return <div></div>
         }
}
The console.log in the child component simply outputs: undefined, even when I remove changing the value of its state variable.
 
    