Last active
December 6, 2016 04:33
-
-
Save atticoos/0d47a1b1f1d1a890928fbeef95443cb5 to your computer and use it in GitHub Desktop.
a guess at something
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
import render from './render'; | |
class Element extends React.Component { | |
render () { | |
return ( | |
<span>[this.context.foobar}</span> | |
); | |
} | |
} | |
export default context => render( | |
<Element />, | |
context | |
); |
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
import renderElement from './element'; | |
const context = { | |
foobar: 'foobar' | |
}; | |
export default class Main extends React.Component { | |
render () { | |
return renderElement(context) | |
} | |
} |
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
export default function render (element context) { | |
return class ContextContainer extends React.Component { | |
static childContextTypes = context; | |
getChildContext () { | |
return context; | |
} | |
render () { | |
return element | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment