Last active
June 22, 2019 23:32
-
-
Save greaveselliott/a1e260fc6f9006b39a9b5eb9380c85f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { createContext, useReducer } from "react"; | |
import reducer from "./reducer"; | |
export const Store = createContext(); | |
const initialState = { | |
list: [] | |
}; | |
export function StoreProvider({ children }) { | |
const [state, dispatch] = useReducer(reducer, initialState); | |
const value = { state, dispatch }; | |
return <Store.Provider value={value}>{children}</Store.Provider>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment