
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
global-context-store
Advanced tools
This package makes managing global state easier.
First wrap your app with the <Store /> context provider.
import Store from "global-context-store";
// ...
return (
<Store>
<App />
</Store>
)
Then, any descendent of <Store /> can set and retrieve items from the global state via the useStore hook:
import { useStore } from "global-context-store";
function DeepChildComponent() {
const { set } = useStore()
set("portfolio.stocks[0]", "AAPL")
}
This will update the state so it looks like:
const { state } = useStore()
console.log(state)
// { portfolio: stocks: [ "AAPL" ]}
set(path, value)useslodash.setunder-the-hood. Hence if a portion of thepathdoesn't exist, it's created. You can read up more on how it works here: https://lodash.com/docs/4.17.15#set
We also provide get(path), invoke(path, fn), push(path, value), and unset(path).
const { set, get, invoke, push, unset } = useStore()
set("portfolio.stocks[0]", "AAPL")
get("portfolio") // { stocks: [ "AAPL"] }
get("portfolio.stocks") // [ "AAPL" ]
push("portfolio.stocks", "TSLA")
get("portfolio.stocks") // [ "AAPL", "TSLA" ]
invoke("portfolio.stocks", tickers => ticker.map(ticker => "$" + ticker) )
get("portfolio.stocks") // [ "$AAPL", "$TSLA" ]
unset("portfolio.stocks")
get("portfolio") // { }
FAQs
This package makes managing global state easier.
We found that global-context-store 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
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.