
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.
react-provider-maker
Advanced tools
Share hooks between any component in your app!
Install
npm install react-provider-maker
or
yarn add react-provider-maker
creating the provider!
// auth-provider.ts
import { makeProvider } from "../lib";
import { useState, useCallback } from "react";
// Hook with any logic you want to share
function useAuth() {
const [isAuth, setAuth] = useState(false);
const login = useCallback((user, password) => {
// validate login
if (user && password) {
setAuth(true);
}
}, []);
return { isAuth, login };
}
// Creating provider and exporting its Provider to implemented and its hook to use it
export const {
Provider: AuthProvider,
useProvider: useAuthProvider,
} = makeProvider(useAuth);
Initializing in your app
// app.tsx
import * as React from "react";
import { AuthProvider } from "./auth-provider";
import LoginForm from "./login-form";
function App() {
return (
<AuthProvider>
<LoginForm />
</AuthProvider>
);
}
export default App;
Using it in any component inside your app
// auth-provider.tsx
import * as React from "react";
import { useAuthProvider } from "./auth-provider";
function LoginForm() {
const { isAuth, login } = useAuthProvider();
return isAuth ? (
<div>loged in</div>
) : (
<div onClick={() => login("user", "password")}>click to login</div>
);
}
export default LoginForm;
FAQs
A simple library to make react providers
The npm package react-provider-maker receives a total of 1 weekly downloads. As such, react-provider-maker popularity was classified as not popular.
We found that react-provider-maker 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
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.