New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@stardust-ui/state

Package Overview
Dependencies
Maintainers
6
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stardust-ui/state

A set of utils to create framework agnostic and reusable state managers

Source
npmnpm
Version
0.38.0-4
Version published
Weekly downloads
16
6.67%
Maintainers
6
Weekly downloads
 
Created
Source

@stardust-ui/state

A set of utils to create framework agnostic and reusable state managers.

  • Installation
  • Usage
  • Usage with React

Installation

NPM

npm install --save @stardust-ui/state

Yarn

yarn add @stardust-ui/state

Usage

import { useStateManager } from '@stardust-ui/react-bindings'
import { createManager, ManagerFactory } from '@stardust-ui/state'

type InputState = { value: string }
type InputActions = { change: (value: string) => void }

const createInputManager: ManagerFactory<InputState, InputActions> = config =>
  createManager<InputState, InputActions>({
    ...config,
    actions: {
      change: (value: string) => () => ({ value }),
    },
    state: { value: '', ...config.state, },
  })
const manager = createInputManager()

Usage with React

We provide React bindings under @stardust-ui/react-bindings.

FAQs

Package last updated on 18 Sep 2019

Related posts