6.2: Props Answer 2
import React from 'react';
export default class PropsDemo extends React.Component{
render(){
return(
<div className="main">
<div className="mainDiv">
<FunctionalComp string="will this display?"/>
<FunctionalComp string="Binary Solo! 1001001"/>
<FunctionalComp string="Vader > Snoke"/>
<FunctionalComp string="You're a wizard, Harry!"/>
</div>
</div>
)
}
}
const FunctionalComp = (props) => {
return(
<div>
<p>{props.string}</p>
</div>
)
}Last updated