Higher Order Component
A Simple Higher Order Component example
Simple example
For loading spinner with different Component1234567891011121314151617181920// HOC declarationfunction withLoadingSpinner(Component) { return function EnhancedComponent({ isLoading, ...props }) { if (!isLoading) { return <Component { ...props } />; } return <LoadingSpinner />; };}// Usageconst ListItemsWithLoadingIndicator = withLoadingSpinner(ListItems);<ListItemsWithLoadingIndicator isLoading={props.isLoading} list={props.list}/>
Recompose
https://github.com/rafrex/spa-github-pages
A React Library for HOC