react-context
react-context copied to clipboard
Support in React v0.15.x with ES6-style classes
Just discovered this but can't get it to work in v15.4.2 with ES6-style classes. Since contextTypes are experimental in React I wondered if this library is still supported.
This will work just fine with ES6 classes as long as you wrap the export:
class SomeComponent extends React.Component {
render() {
<div>SomeComponent</div>
}
}
export default context(SomeComponent)
While contextTypes are experimental, there is a lot of infrastructure built on them already (react-rexux) so there will definitely be something similar if it ever goes away.