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 stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #functional #component
ADD COMMENT
Topic
Name
8+2 =