Skip to content

Instantly share code, notes, and snippets.

@frivolta
Created May 27, 2022 15:37
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 frivolta/f27ac173f8614f2ed8572d6556b38cd2 to your computer and use it in GitHub Desktop.
Save frivolta/f27ac173f8614f2ed8572d6556b38cd2 to your computer and use it in GitHub Desktop.
Write better React, compose multiple functional HoCs, Higher-Order Components - Higher Order Component
export const withUser = (Component) => (props) => {
// Passing the user that you fetched
const currentUser = { authtenticated: true, email: "email@email.com" };
return <Component currentUser={currentUser} {...props} />;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment