react-context icon indicating copy to clipboard operation
react-context copied to clipboard

Support in React v0.15.x with ES6-style classes

Open stahlmanDesign opened this issue 8 years ago • 1 comments

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.

stahlmanDesign avatar Mar 13 '17 14:03 stahlmanDesign

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.

casesandberg avatar Mar 13 '17 20:03 casesandberg