If you want to pass the state {name: "helloworld"}, do it like this:
class App extends React.Component { constuctor(props) { super(props); this.state = {name:"helloworld"}; } render() { return( <ChildComponent {...this.state} /> ); } }
and in the child component you can do:
<Text>{this.props.name}</Text>
But if you want to pass the component details to this descendant:
class App extends React.Component { constuctor(props) { super(props); this.state = {name:"helloworld"}; } render() { return( <ChildComponent {...this.props} /> ); } }
and in the child component you can do:
<Text>{this.props.stuff}</Text>//place stuff by any property name in props
Now, if you want to update the state of the parent component from the child component, you will need to pass the function to the child component:
class App extends React.Component { constuctor(props) { super(props); this.state = {name:"helloworld"}; } update(name){ this.setState({name:name})
and then in the child component you can use this: this.props.update('new name')
UPDATE
use more es6 and remote constructor
class App extends React.Component { state = {name:"helloworld"};
source share