Cannot find namespace ‘ctx’ error when creating Context with react – typescript

Your file extension is most likely .ts instead of .tsx.

Therefore TypeScript is interpreting <ctx.Provider as cast and tries to find a type Provider in the namespace ctx.

Leave a Comment