import React from 'react'
class StateAndPropsComponent extends React.Component {
constructor (props) {
super(props);
this.state = {
//state declared here
thisheader: 'StateAndPropsComponent here',
thiscontent: 'StateAndPropsComponent content here'
}
}
render () {
return (
<div>
//populate class (Sub)component using data from state
<Header headerProp = {this.state.thisheader}/>
<Content contentProp = {this.state.thiscontent}/>
</div>
)
}
}
class Header extends React.Component {
render () {
return (
<div>
//JSX string of headerProp called here, using data from state
<h3>{this.props.headerProp}</h3>
</div>
)
}
}
class Content extends React.Component {
render () {
return (
<div>
//JSX string of contentProp called here, using data from state
<p>{this.props.contentProp}</p>
</div>
)
}
}
export default StateAndPropsComponent;