title: How to get value from one component to the other in react js?
body: <p>I tried to get value from other component with the help of props, but it’s not working. </p>
  
  <p>Here is my logic</p>
  
  <p>main.js makes request to child.js component and in child.js I get age but it isn’t working.</p>
  
  <pre><code>class Main Connect extends Component {
     constructor(props) {
         this.age = this.props.age
     }
  
     render() {
        &lt;Child /&gt;
        return(this.age)
     }
  
  }
  
  class Child Connect extends Component {
  
     render()
        return(&lt;Main age='21' /&gt;)
  
  }
  </code></pre>