New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-storm

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-storm

A small storm in the React Store world

latest
Source
npmnpm
Version
0.5.2
Version published
Maintainers
1
Created
Source

react-storm

A simple React store management library.

Getting started

npm i react-storm

Usage Example

  • define a store/model (e.g. model.ts)
import { createModel } from "react-storm";

class TestVM {
  testNum = 3;

  public setTestNum(value: number) {
    this.testNum = value;
  }
}

const useTestVM = createModel(TestVM);

export default useTestVM;
  • create your component (e.g. Clicker.tsx)
import useTestVM from "./model";
import { useCallback } from "react";

const Clicker = () => {
  const { testNum, setTestNum } = useTestVM(
    ({ testNum, setTestNum }) => ({
        testNum,
        setTestNum
    })
  );

  const handleClick = useCallback(() => {
    setTestNum(testNum + 1);
  }, [setTestNum, testNum]);

  return (
    <>
      <code>{testNum}</code>
      <button onClick={handleClick}>+</button>
    </>
  );
};

export default Clicker;
  • Use your component
import "./styles.css";
import Clicker from "./clicker";

export default function App() {
  return (
    <div className="App">
        <Clicker />
        <Clicker />
    </div>
  );
}

Keywords

react

FAQs

Package last updated on 06 Apr 2025

Did you know?

Socket

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.

Install

Related posts