I need to transfer props from one file to another file. I have file App.js which contains the following code
import React, { Component } from 'react';
import {graphql, QueryRenderer} from 'react-relay';
import environment from './environment';
import Toolbar from './components/Toolbar';
class App extends Component {
render() {
return (
<select onChange={this.props.onSelectionChange} value = {this.props.text}>
<option value="India">India</option>
<option value="Australia">Australia</option>
</select>
);
}
}
and another file called map.js which looks like:
import App from './App';
class PublicMap extends React.Component {
constructor(props) {
super(props);
this.state = {
text: 'India'
};
this.handleText = this.handleText.bind(this);
}
handleText(event) {
const value = event.target.value;
this.setState({ text: value });
}
render() {
return (
<div>
<App text={this.state.text} onSelectionChange={this.handleText}/>
</div>
);
}
}
But am getting no value in my map.js file from App.js file, Please help. thanks in advance