Skip to content

Instantly share code, notes, and snippets.

@MeetMartin
Created April 16, 2019 08:59
Show Gist options
  • Save MeetMartin/ec997d8ef48eb6a7b20e10c7a8e5005c to your computer and use it in GitHub Desktop.
Save MeetMartin/ec997d8ef48eb6a7b20e10c7a8e5005c to your computer and use it in GitHub Desktop.
// src/components/MyComponent.js
import React, {useContext} from 'react';
import {StoreContext} from '../store/StoreContext';
const MyComponent = () => {
const {state, actions} = useContext(StoreContext);
return(
<button onClick={() => actions.triggerAction('data')}>Click me</button>
)
};
export default MyComponent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment