Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- import createActions from './createActions';
- import useAsyncReducer from '../../hooks/useAsyncReducer';
- import reducer, { initialState } from './reducer';
- export const CounterContext = React.createContext();
- export const CounterProvider = ({ children }) => {
- const [state, dispatch] = useAsyncReducer(reducer, initialState);
- const actions = createActions(dispatch);
- return (
- <CounterContext.Provider value={[state, actions]}>
- {children}
- </CounterContext.Provider>
- );
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement