Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
context-store
Advanced tools
[![License MIT](https://img.shields.io/dub/l/vibe-d.svg)](LICENSE) [![NPM Version](https://img.shields.io/npm/v/context-store.svg)](https://www.npmjs.com/package/context-store)
使用 React Context API 实现的简单全局状态管理
npm install context-store
// Store.js
import contextStore from "context-store";
export default contextStore({
message: "hello",
updateMessage() {
this.setState({ message: `hello ${Math.random()}` });
}
});
// AComponent.js
import React from "react";
import Store from "./Store";
export default () => (
<Store.Consumer>{context => <div>{context.message}</div>}</Store.Consumer>
);
// BComponent.js
import React from "react";
import Store from "./Store";
export default () => (
<Store.Consumer>
{context => (
<button onClick={() => context.updateMessage()}>updateMessage</button>
)}
</Store.Consumer>
);
// index.js
import React from "react";
import { render } from "react-dom";
import Store from "./Store";
import AComponent from "./AComponent";
import BComponent from "./BComponent";
const App = () => (
<Store.Provider>
<AComponent />
<BComponent />
</Store.Provider>
);
render(<App />, document.getElementById("root"));
FAQs
Simple global state management using the React Context API
The npm package context-store receives a total of 0 weekly downloads. As such, context-store popularity was classified as not popular.
We found that 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.