how to pass value from one component to another in react native

Solutions on MaxInterview for how to pass value from one component to another in react native by the best coders in the world

showing results for - "how to pass value from one component to another in react native"
Roberta
04 Jan 2020
1##### Inside ParentComponent.js
2
3import React from 'react'
4import ChildComponent from './ChildComponent';
5
6class ParentComponent extends React.Component {
7render(){
8    return(
9    <div>
10        <ChildComponent message="Data from first component"/>
11    </div>
12      );
13   }
14}
15
16export default ParentComponent;
17
18
19##### Inside ChildComponent.js
20
21import React from 'react';
22const ChildComponent = (props) => {
23    return(
24          <h2> {props.message} </h2>
25    );
26}
27export default ChildComponent;