Last active
October 10, 2017 22:52
-
-
Save danny-andrews/d8bc8640ab125d2b5857070d6e472c47 to your computer and use it in GitHub Desktop.
React Abstractions: Component Injection
This file contains 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
const LuckyNumber = ({ component: Component }) => <Component number={Math.random()} />; | |
const AppBody = ({ number }) => <div>Your number is: {number}!</div>; | |
const App = () => <LuckyNumber component={AppBody} />; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment