DashboardContext.js
15 lines
| 1 | |
| 2 | import React, { createContext, useReducer } from 'react'; |
| 3 | |
| 4 | const DashboardContext = createContext(); |
| 5 | |
| 6 | export const DashboardProvider = ({ dashboardReducer, initialState, children }) => { |
| 7 | return ( |
| 8 | <DashboardContext.Provider value={useReducer(dashboardReducer, initialState)}> |
| 9 | {children} |
| 10 | </DashboardContext.Provider> |
| 11 | ); |
| 12 | }; |
| 13 | |
| 14 | export default DashboardContext; |
| 15 |