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

reate

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reate

A lightweight react global state management library

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

Reate

A lightweight react global state management library.

✨ Feature

  • Simple and easy to use, only three APIs.
  • Only 4kb size after build.
  • Support TypeScript static check.
  • No dependencies.

🌈 Install

$ npm i reate --save

😊 Usage

create a store

// store.js
import Reate from 'reate';

export default new Reate(
  {
    visible: false,
  },
  {
    changeVisible: (store, { visible }) => store.setState({ visible });
  }
);

use this store in react

// Test.js
import React from 'react';
import store from './store.js';

function Test() {
  const visible = store.useState('visible');
  return (
    <div>
      <div
        onClick={() => store.dispatch('changeVisible', { visible: !visible })}
      >
        ChangeVisible
      </div>
      {visible ? <div>Hide</div> : <div>Show</div>}
    </div>
  );
}

🔨 License

MIT

Keywords

react

FAQs

Package last updated on 01 Sep 2021

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