create-react-app+ts环境 使用toolkit搭建状态管理出现Provider不能作为JSX组件
所有用例都是官方例子,环境都是最新的版本
ReactDOM.render(
<React.StrictMode>
<Provider store={store}>
<BasicLayout />
</Provider>
</React.StrictMode>,
document.getElementById('root')
);
“Provider”不能用作 JSX 组件。
其实例类型 "Provider<AnyAction>" 不是有效的 JSX 元素。
类型“Provider<AnyAction>”缺少类型“ElementClass”的以下属性: render, context, setState, forceUpdate 及其他 3 项。