@fluentui/state
TypeScript icon, indicating that this package has built-in type declarations

0.66.5 • Public • Published

@fluentui/state

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

Installation

NPM

npm install --save @fluentui/state

Yarn

yarn add @fluentui/state

Usage

import { createManager, ManagerFactory } from '@fluentui/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({ state: { value: 'Hello world!' } });

Usage with React

We provide React bindings under @fluentui/react-bindings.

Readme

Keywords

none

Package Sidebar

Install

npm i @fluentui/state

Weekly Downloads

11,976

Version

0.66.5

License

MIT

Unpacked Size

72.6 kB

Total Files

45

Last publish

Collaborators

  • sopranopillow
  • microsoft1es
  • justslone
  • chrisdholt
  • miroslavstastny
  • levithomason
  • uifabricteam
  • uifrnbot
  • dzearing
  • layershifter
  • ling1726
  • travisspomer