I want to make a context file in which I put a Auth0 identification that is passed as props. Unfortunately I just started with typescript and thus I'm quite struggeling. Here is my file.
import React from 'react';
import { createContext, useContext} from 'react'
import { Auth0Provider } from '@auth0/auth0-react'
export const Auth0Context = createContext(<Partial<ContextProps>>({}));
const domain = process.env.REACT_APP_AUTH0_DOMAIN;
const clientId = process.env.REACT_APP_AUTH_CLIENT_ID;
const authValues: any = {
domain: React.ReactChild,
clientId: React.ReactChild
}
export default function AuthProvider({children:React.ReactNode}){
return (
<Auth0Context.Provider>
<Auth0Provider
value={authValues}
>
{children}
</Auth0Provider>
</Auth0Context.Provider>
);
}
For instance, I'm not sure of which type the env variables are and how I can declare the children type accurately. Thanks very much for helping me out!