react-context
Version:
Helpful Properties with React Context
28 lines (19 loc) • 532 B
JSX
/* jshint node: true, esnext: true */
;
var React = require('react');
var context = require('react-context');
var Child = React.createClass({
// subscribe to all the contextTypes
contextTypes: context.subscribe(),
render(){
var contexts = [];
for (var key in this.context){
var value = this.context[key];
contexts.push(<div key={ key }><span>{ key }:</span> <span>{ value.toString() }</span></div>);
}
return(
<div>{ contexts }</div>
)
}
});
module.exports = Child;