Skip to content

Instantly share code, notes, and snippets.

@rockymeza
Created April 9, 2018 15:51
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 rockymeza/437128eebdd0787816f550524da89b99 to your computer and use it in GitHub Desktop.
Save rockymeza/437128eebdd0787816f550524da89b99 to your computer and use it in GitHub Desktop.
withTime
export const withTime = WrappedComponent => props => (
<GetTime>
{({ currentTime }) => (
<WrappedComponent
// by passing currentTime first and ...props second, we allow
// parent components to override the currentTime
currentTime={currentTime}
{...props}
/>
)}
</GetTime>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment