Created
October 5, 2017 15:26
-
-
Save jimbol/cf701b29be4999c4fd7ab316e25dc3ca to your computer and use it in GitHub Desktop.
Passing a component as a prop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { UserComp, OtherPersonComp } from './components'; | |
const PersonComp = ({ InnerComp, person }) => { | |
return <section> | |
<InnerComp person={person}> | |
</section>; | |
} | |
const mapState = (state) => ({ | |
InnerComp: state.person.isUser ? UserComp : OtherPersonComp, | |
person: state.selectedPerson, | |
}); | |
export const LinkedPersonComp = connect(mapState)(PersonComp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment