Closed bluebill1049 closed 1 year ago
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.
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≥
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