React: Pass component as prop without using this.props.children
问题 I have this a component Foo.js : // a svg component with a star.svg icon import { IconStar } from 'react-svg-icons'; // call a button with a custom icon <Button icon={ IconStar }> Click to trigger </Button> And then on button.js I have: render() { const theIcon = this.props.icon; return ( <button> {this.props children} {icon() /*this works but i can't pass props inside it*/} <theIcon className={ Styles.buttonIcon } /> </button> ) } I want to render <IconStar> inside <Button> , how do I do