export const EmployeeContext = createContext<EmployeesList[] | null>(null);
export const EmployeeProvider = ({ children }) => {
const [employeeList, setEmployeeList] = useState<EmployeesList[] | null>(null);
useEffect(() => {
async function fetchData() {
const results = await fetchEmployeeList();
setEmployeeList(results);
}
fetchData()
}, []);
return (
<EmployeeContext.Provider value={[employeeList, setEmployeeList]}>
{children}
</EmployeeContext.Provider>
);
}
Both employeeList and setEmployeeList is throwing an error as "Type 'EmployeesList[]' is missing the following properties from type 'EmployeesList': userId, jobTitleName, firstName, lastName, and 5 more"
Even though i have set or as null statement, and i have tried with default object also, still same error
