Actions

Actions enable you to make changes to the internal AppState via the dispatcher.

This is a partial reference of the most useful actions. A full reference is available in the codebase.

Types

setData

Modify the data payload currently managed by Puck.

ParamExampleTypeStatus
typetype: "setData"”setData”Required
datadata: {}DataRequired

Example

dispatch({
  type: "setData",
  data: {},
});

setUi

Change a value on Puck’s UI state.

ParamExampleTypeStatus
typetype: "setUi"”setUi”Required
uiui: { leftSideBarVisible: false }UiStateRequired

Example

dispatch({
  type: "setUi",
  ui: {
    leftSideBarVisible: false,
  },
});

set

Change the entire AppState in a single action.

ParamExampleTypeStatus
typetype: "set"”set”Required
statestate: { data: {}, ui: {} }AppStateRequired

Example

dispatch({
  type: "set",
  state: { data: {}, ui: {} },
});