Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

pass component as props react

const Label = props => <span>{props.children}</span>
const Button = props => {
    const Inner = props.inner; // Note: variable name _must_ start with a capital letter 
    return <button><Inner>Foo</Inner></button>
}
const Page = () => <Button inner={Label}/>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pass #component #props #react
ADD COMMENT
Topic
Name
6+1 =