Skip to content

Instantly share code, notes, and snippets.

@nightspirit
Created April 15, 2018 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nightspirit/a552e388a180f618bbf60847c39eb1b6 to your computer and use it in GitHub Desktop.
Save nightspirit/a552e388a180f618bbf60847c39eb1b6 to your computer and use it in GitHub Desktop.
react context example
import React from 'react'
import { withCounter } from './context'
const IncBtn = ({ counter }) => <button type='button' className='btn btn-primary btn-block' onClick={counter.inc}>+</button>
const CounterIncBtn = withCounter(IncBtn)
export default CounterIncBtn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment