
Security News
gem.coop Tests Dependency Cooldowns as Package Ecosystems Move to Slow Down Attacks
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.
@wroud/di-react
Advanced tools
@wroud/di-react is a set of bindings (components and hooks) for integrating the @wroud/di dependency injection library with React. It simplifies dependency management in React applications by providing easy-to-use tools for accessing services and managing their lifecycles within React components.
@wroud/di service container to React components.useService and useServices.ServiceProvider component to provide services to your component tree.@wroud/di features.You can install @wroud/di-react using npm, yarn, pnpm, or bun:
Install via npm:
npm install @wroud/di-react
Install via yarn:
yarn add @wroud/di-react
Here's a quick example of how to use @wroud/di-react in your project:
import React from 'react';
import { ServiceContainerBuilder } from '@wroud/di';
import { ServiceProvider, useService } from '@wroud/di-react';
// Step 1: Create and configure your service container
const builder = new ServiceContainerBuilder();
builder.addSingleton(SomeService);
const serviceProvider = builder.build();
// Step 2: Use ServiceProvider to make the services available in your component tree
function App() {
return (
<ServiceProvider provider={serviceProvider}>
<MyComponent />
</ServiceProvider>
);
}
// Step 3: Use hooks to access services in your components
function MyComponent() {
const someService = useService(SomeService);
return <div>{someService.doSomething()}</div>;
}
For detailed usage and API reference, visit the documentation site.
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
A simple and lightweight dependency injection library for React
The npm package @wroud/di-react receives a total of 226 weekly downloads. As such, @wroud/di-react popularity was classified as not popular.
We found that @wroud/di-react demonstrated a healthy version release cadence and project activity because the last version was released less than 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
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.

Security News
Following multiple malicious extension incidents, Open VSX outlines new safeguards designed to catch risky uploads earlier.

Research
/Security News
Threat actors compromised four oorzc Open VSX extensions with more than 22,000 downloads, pushing malicious versions that install a staged loader, evade Russian-locale systems, pull C2 from Solana memos, and steal macOS credentials and wallets.