I am currently writing my context API like so:
import React, { useState, createContext, SetStateAction } from 'react'
type LoginContextProps = [boolean, React.Dispatch<SetStateAction<boolean>>]
export const LoginContext = createContext<LoginContextProps>([])
export const LoginProvider = ({
children,
}: React.PropsWithChildren<unknown>) => {
const [isLogin, setIsLogin] = useState(false)
return (
<LoginContext.Provider value={[isLogin, setIsLogin]}>
{children}
</LoginContext.Provider>
)
}
I am however unsure how to satisfy typescript on the createContext portion of the code, what two objects can I pass through to make typescript type aware and not complain?