Answers for "how to pass value from one component to another in react native"

0

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

##### Inside ParentComponent.js

import React from 'react'
import ChildComponent from './ChildComponent';

class ParentComponent extends React.Component {
render(){
    return(
    <div>
        <ChildComponent message="Data from first component"/>
    </div>
      );
   }
}

export default ParentComponent;


##### Inside ChildComponent.js

import React from 'react';
const ChildComponent = (props) => {
    return(
          <h2> {props.message} </h2>
    );
}
export default ChildComponent;
Posted by: Guest on September-29-2021

Code answers related to "how to pass value from one component to another in react native"

Code answers related to "Javascript"

Browse Popular Code Answers by Language