Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140101

How can I import data from the child container to the parent container in react?

$
0
0

Parent Component

import React, {Component} from 'react';
import NameContainer from '../nameContainer/index'


export default class Vishal extends Component {
    constructor(props) {
        super(props);
        this.state = {
            data: "This is the data"
        }
    }

      render() {
          return(
              <div>
                <p>My name is Vishal</p>
              </div>
          )
      }
}


Child Component

import React, {Component} from 'react';

export default class NameContainer extends Component {

}

How can I use a callback function and import from the child component? Any help will be highly appreciated


Viewing all articles
Browse latest Browse all 140101

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>