
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-hooks-shared-state
Advanced tools
A global state for React with Hooks API.
$ npm install react-hooks-shared-state --save
https://kelp404.github.io/react-hooks-shared-state
const {useSharedState} = require('react-hooks-shared-state');
const Component = () => {
const [state, setState] = useSharedState(null, {value: 'hello'});
const onChange = e => {
setState(Object.assign({}, state, {value: e.target.value}));
};
return (
<input value={state.value} onChange={onChange}/>
);
};
const {useSharedState} = require('react-hooks-shared-state');
const sharedState = require('react-hooks-shared-state');
sharedState.useState()
useSharedState and sharedState.useState are the same one.
const {setSharedState} = require('react-hooks-shared-state');
Assign a new stateful value.
stateType: any
Required: required
const {useSharedState} = require('react-hooks-shared-state');
Returns a stateful value, and a function to update it.
pathType: string
Required: optional
The object path of the state.
When the path is null it will return the state(root).
If you just want to use a part of state in the component, pass the object path.
initialStateType: any
Required: optional
The initial state.
FAQs
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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.