rfa
Version:
**React Form Architect** is an ultimate solution for creating and rendering forms in React. Its main focus is to provide users with a tool to define, render and share a form in a browser.
20 lines (17 loc) • 519 B
text/typescript
import { initialState, FormSchemaType } from './store';
import type { StoreActions } from 'react-simple-hook-store';
export type StoreGlobalActions = {
setStore: (newStore: FormSchemaType) => void;
clearStore: () => void;
};
export const storeActions: StoreActions<FormSchemaType, StoreGlobalActions> = {
setStore: (store, newStore) => {
store.setState({
elements: newStore.elements,
grouping: newStore.grouping,
});
},
clearStore: (store) => {
store.setState(initialState);
},
};