Skip to content

Instantly share code, notes, and snippets.

@aloukissas
Created January 14, 2019 15:39
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 aloukissas/6eb31b7957bdc367829930c3c5382d56 to your computer and use it in GitHub Desktop.
Save aloukissas/6eb31b7957bdc367829930c3c5382d56 to your computer and use it in GitHub Desktop.
import React from "react";
export const AuthContext = React.createContext({});
export const withAuthContext = ChildComponent => props => (
<AuthContext.Consumer>
{context => <ChildComponent {...props} auth={context} />}
</AuthContext.Consumer>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment