
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@srph/react-hoc-compose
Advanced tools
Compose factory components (HOCs) on the go without variable assignment
You may find this useful if you're using React Router v4. The following no longer has "abstract" routes:
<Route component={App}>
<Route exact path="/" component={AppHome} />
</Route>
If you do, you'll get the following console warning:
You should not use <Route component> and <Route children> in the same route; <Route children> will be ignored
Instead, the library advices on doing the following:
<App>
<Route exact path="/" component={AppHome} />
</App>
I use HOCs to apply permissions on each route (the following uses React Router as an example), like so:
<App>
<Route path="/login" component={Permission.guest(AppLogin)} />
<Permission.auth(AppMain)>
<Route path="/" component={AppHome} />
<Route path="/trash" component={AppHome} />
</Permission.auth(AppMain)>
</App>
Since <Permission.auth(AppMain)> isn't a valid syntax, we will have to assign it to a variable.
const AppMainWithPermission = Permission.auth(AppMain)
Which gets verbose overtime. What if we could compose it on the go?
<Compose hoc={Permission.auth} component={AppMain}>
<Route path="/" component={AppHome} />
<Route path="/trash" component={AppHome} />
</Compose>
Compose applies the HOC to the component once, on initial mount.
npm install @srph/react-hoc-compose --save
If you're not using a bundler like Browserify or Webpack, simply add the script tag after your React script tag.
<!-- Script tags for React and other libraries -->
<script src="https://unpkg.com/@srph/react-hoc-compose/dist/react-hoc-compose.min.js"></script>
This library is exposed as ReactHOCCompose (e.g., <ReactHOCCompose />).
<Compose hoc={withYolo} component={MyComponent} />
npm test
npm run bundle
FAQs
The bare minimum to build file upload user interfaces
We found that @srph/react-hoc-compose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.