Better to have a contexts and providers folder or only a contexts folder in React project

601 views Asked by At

In my React Typescript project I have a Context and a Context Provider function:

Context:

export const MyContext = createContext<null | MyContextType>(null);

Context Provider

export const MyContextProvider = ({ children }: Props) => {
    // code here
    }

Is it better, more a convention to create a folder contexts and export both function from a context file e.g. MyContext.tsx

Or create another folder: providers and create another provider file there MyContextProvider.tsx?

0

There are 0 answers