Skip to content

PUIHookState

Elijah Cobb edited this page May 13, 2021 · 3 revisions

This set of hooks provide helpful hooks for dealing with state management.

usePUIState

Will return an array much like useState does, but from the global state's context.

const [state, setState] = usePUIState();

usePUIGetState

Will return the current state and update components when changed.

Yes this is the same as usePUIState()[0].

const state = usePUIGetState();

usePUISetState

Will return a function to change the current state.

Yes this is the same as usePUIState()[1].

const setState = usePUISetState();