1/* PASSING THE PROPS to the 'Greeting' component */
2const expression = 'Happy';
3<Greeting statement='Hello' expression={expression}/> // statement and expression are the props (ie. arguments) we are passing to Greeting component
4
5/* USING THE PROPS in the child component */
6class Greeting extends Component {
7 render() {
8 return <h1>{this.props.statement} I am feeling {this.props.expression} today!</h1>;
9 }
10}
1const Label = props => <span>{props.children}</span>
2const Button = props => {
3 const Inner = props.inner; // Note: variable name _must_ start with a capital letter
4 return <button><Inner>Foo</Inner></button>
5}
6const Page = () => <Button inner={Label}/>
7