Trying to work out how to pass types to value?
<Context.Provider value={[state, dispatch]}>{children}
</Context.Provider>
Type 'unknown[]' is missing the following properties from type 'InitialState': navigateTo, user, avatar, dashBoardSelectedMenuItemts(2739) index.d.ts(338, 9): The expected type comes from property 'value' which is declared here on type 'IntrinsicAttributes & ProviderProps' (JSX attribute) React.ProviderProps.value: InitialState
import React, { createContext } from "react";
import Reducer from "./reducer";
interface InitialState {
navigateTo: string;
user: string;
avatar: string;
dashBoardSelectedMenuItem: string;
}
const initialState: InitialState = {
navigateTo: "dashboard",
user: null,
avatar: null,
dashBoardSelectedMenuItem: "dashboard",
};
export const Context = createContext<InitialState>(initialState);
const Store = ({ children }) => {
const [state, dispatch] = React.useReducer<any>(Reducer, initialState);
return (
<Context.Provider value={[state, dispatch]}>{children}</Context.Provider>
);
};
export default Store;
Thanks for looking.