Skip to content

Instantly share code, notes, and snippets.

@danny-andrews
Last active December 4, 2017 16:39
Show Gist options
  • Save danny-andrews/340660e5f76b962f7698927d182b080a to your computer and use it in GitHub Desktop.
Save danny-andrews/340660e5f76b962f7698927d182b080a to your computer and use it in GitHub Desktop.
React Abstractions: HoC example
const withLuckyNumber = Component => (props) => <Component number={Math.random()} {...props} />;
const UnconnectedApp = ({ number }) => <div>Your number is: {number}!</div>;
const App = withLuckyNumber(UnconnectedApp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment