React (software): Difference between revisions

Content deleted Content added
Line 61:
 
=== Two-way data flow with states ===
States hold values throughout the component and can be passed to child components through props:
<syntaxhighlight linelang="1" start="1js">
class ParentComponent extends React.Component {
this.state = {
state = { color: 'red' };
render() {
}
 
render() {
return (
<child_componentChildComponent childColorcolor={this.state.color} />
);
}
}
</syntaxhighlight>