Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
react context example
import React from 'react'
const ctx = React.createContext()
export const {Provider, Consumer} = ctx
export const withCounter = Component => props => <Consumer>{value => <Component {...props} counter={value} />}</Consumer>
export default ctx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment