6.2: Props Answer 2

Here is a possible solution to last page's challenge. You should be able to see each of these strings stacked on top of each other in your page's display.

PropsDemo.js

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