Skip to content

Instantly share code, notes, and snippets.

@jossmac
Last active November 1, 2018 03:07
Show Gist options
  • Save jossmac/1f0c8781722b6bbb91b2c725e3b5ca73 to your computer and use it in GitHub Desktop.
Save jossmac/1f0c8781722b6bbb91b2c725e3b5ca73 to your computer and use it in GitHub Desktop.
Pseudo code for a consumer component
import React from 'react';
import { ToastContext } from './Provider';
export const ToastConsumer = ({ children }) => (
<ToastContext.Consumer>
{context => children(context)}
</ToastContext.Consumer>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment