
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.
Statera is a lightweight, easy-to-use state management library for React applications. It provides a simple and intuitive API for managing and sharing state across components without the need for complex setups or provider components.
npm install statera
# or
yarn add statera
# or
pnpm add statera
Here's a quick example of how to use Statera:
import React from "react";
import { statera } from "statera";
// Create a shared state
const useCounter = statera(0);
function Counter() {
const [count, setCount] = useCounter();
return (
<div>
<p>Count: {count}</p>
<button onClick={() => setCount(count + 1)}>Increment</button>
<button onClick={() => setCount((prev) => prev - 1)}>Decrement</button>
</div>
);
}
function App() {
return (
<div>
<Counter />
<Counter />
</div>
);
}
In this example, both Counter components share the same state. Updating the count in one component will update it in the other as well.
const useMyState = statera(initialState);
Creates a new shared state with the given initial value and returns a custom hook.
const [state, setState] = useMyState();
Returns a tuple containing the current state and a setter function, similar to React's useState.
The setter function can be used in two ways:
Passing a new value directly:
setState(newValue);
Passing a function that receives the previous state:
setState(prevState => /* compute and return new state */);
Statera supports Server-Side Rendering out of the box. It works seamlessly with frameworks like Next.js without any additional configuration.
useSyncExternalStore, Statera ensures efficient updates and renders.Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Sangeet Banerjee
FAQs
A lightweight state management library for React
We found that statera demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.