Skip to content

Instantly share code, notes, and snippets.

@camd
Created May 15, 2018 16:29
Show Gist options
  • Save camd/09358e3a4b134d896703dc1290482fc9 to your computer and use it in GitHub Desktop.
Save camd/09358e3a4b134d896703dc1290482fc9 to your computer and use it in GitHub Desktop.
import React from 'react';
export const PinBoardContext = React.createContext({
pinnedJobs: [],
relatedBugs: [],
pinJob: () => { console.log("pinJob raw"); },
addBug: () => { console.log("addBug raw"); },
});
export function withPinBoard(Component) {
return function PinBoardComponent(props) {
return (
<PinBoardContext.Consumer>
{pinBoard => <Component {...props} pinBoard={pinBoard} />}
</PinBoardContext.Consumer>
);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment