@fluentui/state
一套用于创建框架不可知和可再用状态管理器的图案.
安装
国家预防机制
npm install --save @fluentui/state
雅伦
yarn add @fluentui/state
使用量
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!' } });
使用反应
我们提供反应约束 @fluentui/react-bindings。 。 。 .