Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

functional component

const MySubComponent = (props) => {
    if (props.display) {
        return <p>This text is displayed</p>
    }
}

class MyComponent extends React.Component {
    render() {
        return (
            <MySubComponent display={true} />
        )
    }
}
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #functional #component
ADD COMMENT
Topic
Name
1+1 =