Create re-state Dispatch
This method update data on store
//mutedState.tsimport { createReState, createReStateDispatch } from '@raulpesilva/re-state'
export type Muted = booleanexport const key = 'muted'
export const useMuted = createReState<Muted>(key, true)export const muteDispatch = createReStateDispatch<Muted>(key)export const toggleMute = () => muteDispatch(prev => !prev)
//MyComponent.tsximport type { Muted,toggleMute } from './mutedState'import { key } from './mutedState'
export const MyComponent = () => { const muted = useReStateSelector<Muted>(({muted}=> muted))
return ( <div> <span>{muted ? 'Is muted' : 'Is unMuted'}</span> <button onClick={toggleMute}>Toggle mute</button> </div> )}