
Security News
Re-Enabled GitHub Actions Expose Thousands of Repositories to Mini Shai-Hulud
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.
context-state
Advanced tools
React state management solution with Context Like unstated-next, but Pro
npm i context-state
If you are using v3, please refer to here to upgrade to v4
React Context and useContext have some performance issues. When the context changes, all components that use the context will re-render. With context-state, developers don't need to worry about context penetration issues.
import React from 'react';
import { createStore } from 'context-state';
function useCounter() {
const [count, setCount] = React.useState(0);
const increment = () => setCount((c) => c + 1);
return {
count,
increment,
};
}
const CounterStore = createStore(useCounter);
function CounterDisplay() {
const { count, increment } = CounterStore.usePicker(['count', 'increment']);
return (
<div>
{count}
<button
type='button'
onClick={increment}
>
ADD
</button>
</div>
);
}
function App() {
return (
<CounterStore.Provider>
<CounterDisplay />
</CounterStore.Provider>
);
}
render(<App />, document.getElementById('root'));
createContainer(useHook, options)import { createStore, useMemoizedFn } from 'context-state';
function useCustomHook(props: {
initialValue: string;
}) {
const [value, setInput] = useState(props.initialValue);
const onChange = useMemoizedFn((e) => setValue(e.currentTarget.value));
return {
value,
onChange,
};
}
const Store = createStore(useCustomHook, {
// middlewares, used to listen to store changes
middlewares: [{
onInit: () => {},
onChange: () => {}
}]
});
// Store === { Provider, useStore }
If useCustomHook has parameters, they can be passed through Store.Provider.
<Container.Provider>const Container = createContainer(useCustomHook);
function ParentComponent({ children }) {
return <Container.Provider>{children}</Container.Provider>;
}
<Store.Provider>const Store = createStore(useCustomHook);
function ParentComponent({ children }) {
return <Store.Provider initialValue={'value'}>{children}</Store.Provider>;
}
Store.useStore()useStore is used to get the return value from the Provider.
useStore accepts 3 types of parameters:
function App() {
const { count } = Store.useStore(['count']);
}
function App() {
const count = Store.useStore((store) => store.count);
}
function App() {
const store = Store.useStore();
}
For best performance, it is recommended to use 1 and 2, which can avoid unnecessary rendering.
FAQs
Like unstated-next, but Pro
The npm package context-state receives a total of 59 weekly downloads. As such, context-state popularity was classified as not popular.
We found that context-state 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.

Security News
Two compromised GitHub Actions were re-enabled with malicious tags intact, exposing thousands of downstream repositories to Mini Shai-Hulud.

Research
/Security News
A malicious Firefox extension fetches its payload after installation to evade detection, steal Google session cookies, and automate account takeover.

Research
/Security News
The compromise affects MemTensor's MemOS, an open source memory framework for large language models (LLMs) and AI agents. Both npm package @memtensor/memos-cloud-openclaw-plugin and the PyPI package MemoryOS are compromised. They drop cross-platform Go binaries that exfiltrate developer secrets.