reactjs - 输入“提供者”' 不见了
问题描述
我正在用打字稿做反应项目。
这是我在 index.ts 中的代码
const store = configureStore(initialStateFromDB);
ReactDOM.render(
<Provider store={store}>
<App></App>
</Provider>,
document.getElementById('app')
);
我得到了很多错误!
第一的。
Type 'Provider<AnyAction>' is missing the following properties from type 'ReactElement<any, string | ((props: any) => ReactElement<any, string | ... | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)>[]': length, pop, push, concat, and 25 more.ts(2345)
第二
Conversion of type 'Store<{}, AnyAction> & { dispatch: {}; }' to type 'Provider<AnyAction>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.ts(2352)
我无法理解这些错误消息的含义。
我应该怎么做才能解决这个错误?
解决方案
我的天啊
我的文件名是index.ts
我把它改成index.tsx
现在效果很好。
推荐阅读
- android - 如何找到点击的地方或路径 VectorDrawable
- python - 如何在 seaborn FacetGrid 的条形顶部添加百分比?
- python - 如何制作一个按索引从列表中删除元素的函数
- javascript - 在 JavaScript 中使用 for 循环按顺序显示数字
- javascript - Popper.js 库如何在 Vue 实例中运行
- python - Openpyxl 保存损坏/不可读的文件。没有报错,只是shell重启
- python-3.x - 尝试通过 https 从 Windows 7 和 Windows Server 2016 传输大小超过 64kb 的 JSON 时 Python OpenSSL“WantWriteError”
- ansible - 如何通过ansible playbook将文件从控制器节点的/root复制到远程主机的/root
- asp.net-core - 带有 docker-compose 的 Identity Server 4 在 /connect/authorize/callback 之后重定向到登录页面
- java - 使用 byte[] 的 Java 下载文件