Skip to content

Version 4.8.0

Latest
Compare
Choose a tag to compare
@bluebill1049 bluebill1049 released this 23 Sep 07:43
· 3 commits to master since this release

Context

The new method will retrieve the latest store value when an action is performed, this is great for usage such as re-render is not required and yet you want to retrieve the newest store value.

Example

const update  = (state: GlobalState, payload: string) => {
  return {
    ...state,
    value: payload
  }
}

const { getState, actions } = useStateMachine({
  update,
});

<button onClick={() => actions.update('test', { skipRender: true })}>Update<button≥ 
<button onClick={() => getState()}>Get State<button≥