美文网首页
使用useContext时ts2503报错处理

使用useContext时ts2503报错处理

作者: 华健_4106 | 来源:发表于2022-04-17 19:44 被阅读0次

    参考链接

    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.

    相关文章

      网友评论

          本文标题:使用useContext时ts2503报错处理

          本文链接:https://www.haomeiwen.com/subject/stilertx.html