Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
An extremely simple and just as experimental state management library for React. Yes, _another one_. Honestly, even I don't know why this exists. I had an idea and just _had_ to try it, and yet another NPM package was born.
An extremely simple and just as experimental state management library for React. Yes, another one. Honestly, even I don't know why this exists. I had an idea and just had to try it, and yet another NPM package was born.
Do not use this library. It's terrible. In fact, do not use any other library, either. They're all terrible.
Statery stores wrap around plain old JavaScript objects:
const store = makeStore({
wood: 8,
houses: 0
})
Within a React component, use the useStore
hook to read data from the store:
const Wood = () => {
const { wood } = useStore(store)
return <p>Wood: {wood}</p>
}
Naturally, your components will re-render when the data they've accessed changes.
Update the store contents using its set
function:
const collectWood = () =>
store.set((state) => ({
wood: state.wood + 1
}))
const buildHouse = () =>
store.set((state) => ({
wood: state.wood - 10,
houses: state.houses + 1
}))
const Buttons = () => {
return (
<p>
<button onClick={collectWood}>Collect Wood</button>
<button onClick={buildHouse}>Build House</button>
</p>
)
}
That's all there is to it!
There are more React state management libraries out there than actual state, so why build another one? Frankly, I have no excuse. I know. Everything is terrible.
However, I've always felt that there was a state management solution missing that worked exactly the way I wanted, and let me tell you, I only ever want simple things.
State management should be simple, both in use as well as implementation.
Statery makes a couple of assumptions that you may or may not agree with:
set
method that updates its state, everything else should be left to the user.FAQs
A happy little state management library for React and friends.
The npm package statery receives a total of 8 weekly downloads. As such, statery popularity was classified as not popular.
We found that statery 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.