
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@fioc/react
Advanced tools
A lightweight, type-safe dependency injection library for React, built on @fioc/core, with hooks and context providers for seamless dependency management in modern React applications.
@fioc/react is a lightweight dependency injection library for React applications, built on @fioc/core. It provides a type-safe way to manage dependencies in React components using hooks and context providers, without requiring reflection, decorators, or classes.
Install using npm, pnpm, or yarn (requires @fioc/core):
npm install @fioc/core @fioc/react
pnpm install @fioc/core @fioc/react
yarn add @fioc/core @fioc/react
Set up a container manager with @fioc/core or @fioc/strict (see @fioc/core for details). Wrap your app with DependenciesProvider:
// app.tsx
import { DependenciesProvider } from "@fioc/react";
import { buildDIContainer, buildDIManager } from "@fioc/core";
import { ApiServiceToken } from "./interfaces/ApiService";
const container = buildDIContainer()
.register(ApiServiceToken, { getData: () => "Hello, World!" })
.getResult();
const DIManager = buildDIManager()
.registerContainer(container, "default")
.getResult()
.setDefaultContainer("default");
export default function App() {
return (
<DependenciesProvider manager={DIManager}>
<MyComponent />
</DependenciesProvider>
);
}
Use the useDependencies hook to resolve dependencies in components:
// components/MyComponent.tsx
import { useDependencies } from "@fioc/react";
import { ApiServiceToken } from "../interfaces/ApiService";
export function MyComponent() {
const { resolve } = useDependencies();
const apiService = resolve(ApiServiceToken);
return <div>API Data: {apiService.getData()}</div>;
}
@fioc/strict for compile-time validation in complex apps@fioc/next for Next.js Server Components and ActionsContributions welcome! Open issues or submit pull requests on GitHub.
MIT License - see the LICENSE file for details.
Thanks to the open-source community for inspiring this project.
FAQs
A lightweight, type-safe dependency injection library for React, built on @fioc/core, with hooks and context providers for seamless dependency management in modern React applications.
We found that @fioc/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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

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.