Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Our context's provider
import React, { Component, createContext } from 'react';
const { Provider, Consumer } = createContext();
export const StateConsumer = Consumer;
export class StateProvider extends Component {
static defaultProps = {
state: {}
state = this.props.state;
render () {
return (
<Provider value={this.state}>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.