使用useContext时ts2503报错处理

2022-04-17  本文已影响0人  华健_4106

参考链接

createContext实例化,typesript error:找不到命名空间“AppContext”。ts(2503)

Cannot find namespace 'ctx' error when creating Context with react - typescript

修改文件拓展名ts为tsx

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.

上一篇 下一篇

猜你喜欢

热点阅读