Skip to content

Instantly share code, notes, and snippets.

@i-oliva
Created September 22, 2018 16:07
Show Gist options
  • Select an option

  • Save i-oliva/7271c496050bdef59726782786d94d38 to your computer and use it in GitHub Desktop.

Select an option

Save i-oliva/7271c496050bdef59726782786d94d38 to your computer and use it in GitHub Desktop.
ContextProvider
import React, { Component } from "react";
import Context from '../config/Context'
export default class ContextProvider extends Component {
constructor() {
super();
this.state = {
name: "Ismael"
};
}
render() {
return (
<Context.Provider value={{state: this.state}}>
{this.props.children}
</Context.Provider>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment