Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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