export const ToastContext = React.createContext()
function ToastProvider({ children }) {
const [ state, dispatch ] = React.useReducer(PARAMS...)
return (
<ToastContext.Provider state={ { state: state, dispatch: dispatch } }>
{children}
</ToastContext.Provider>
)
}
===========
export const ToastContext = React.createContext()
export const ToastContextUpdater = React.createContext()
function ToastProvider({ children }) {
const [ state, dispatch ] = React.useReducer(PARAMS...)
return (
<ToastContext.Provider state={state}>
<ToastContextUpdater.Provider state={dispatch}>
{children}
</ToastContextUpdater.Provider>
</ToastContext.Provider>
)
}
function ToastProvider({ children }) {
const [ state, dispatch ] = React.useReducer(PARAMS...)
return (
<ToastContext.Provider state={ { state: state, dispatch: dispatch } }>
{children}
</ToastContext.Provider>
)
}
===========
export const ToastContext = React.createContext()
export const ToastContextUpdater = React.createContext()
function ToastProvider({ children }) {
const [ state, dispatch ] = React.useReducer(PARAMS...)
return (
<ToastContext.Provider state={state}>
<ToastContextUpdater.Provider state={dispatch}>
{children}
</ToastContextUpdater.Provider>
</ToastContext.Provider>
)
}