How to use the piral-core.updateKey function in piral-core

To help you get started, we’ve selected a few piral-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github smapiot / piral / src / packages / piral-forms / src / actions.ts View on Github external
swap(ctx, state => {
    const newState = {
      ...initial,
      ...(state.forms[id] || {}),
      ...patch,
    };
    const updatedState = getNewFormState(newState, patch);
    return {
      ...state,
      forms: updateKey(state.forms, id, updatedState),
    };
  });
}