Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createReactContext(
defaultValue: T,
calculateChangedBits: ?(a: T, b: T) => number
): Context {
const contextProp = '__create-react-context-' + gud() + '__';
class Provider extends Component> {
emitter = createEventEmitter(this.props.value);
static childContextTypes = {
[contextProp]: PropTypes.object.isRequired
};
getChildContext() {
return {
[contextProp]: this.emitter
};
}
componentWillReceiveProps(nextProps) {
if (this.props.value !== nextProps.value) {