Reactjs 获得;JSX元素类型';App&x27;没有任何构造或调用签名。”;导出JSX元素数组时出现ts(2604)错误
我有一个返回JSX元素数组的函数。当我将其传递给Reactjs 获得;JSX元素类型';App&x27;没有任何构造或调用签名。”;导出JSX元素数组时出现ts(2604)错误,reactjs,typescript,react-dom,Reactjs,Typescript,React Dom,我有一个返回JSX元素数组的函数。当我将其传递给ReactDOM.render时,我得到了上面的错误 wrappers.tsx const FooterWithStore:React.FC=()=>( ) 常量AppWithStore:React.FC=()=>( ); 常量WrapFooter=(WrappedComponent:React.FC)=>[ , ] const App=WrapFooter(AppWithStore) 导出默认应用程序尝试此解决方案 const FooterWi
ReactDOM.render
时,我得到了上面的错误
wrappers.tsx
const FooterWithStore:React.FC=()=>(
)
常量AppWithStore:React.FC=()=>(
);
常量WrapFooter=(WrappedComponent:React.FC)=>[
,
]
const App=WrapFooter(AppWithStore)
导出默认应用程序
尝试此解决方案
const FooterWithStore:React.FC = () => (
<Provider store={store}>
<FooterLangWrapper />
</Provider>
)
const AppWithStore:React.FC = () => (
<Provider store={store}>
<LangWrapper />
</Provider>
);
const WrapFooter = (WrappedComponent: React.FC) => () => [
<WrappedComponent key="1" />,
<FooterWithStore key="2" />
]
const App = WrapFooter(AppWithStore)
export default App
const FooterWithStore:React.FC=()=>(
)
常量AppWithStore:React.FC=()=>(
);
常量WrapFooter=(WrappedComponent:React.FC)=>()=>[
,
]
const App=WrapFooter(AppWithStore)
导出默认应用程序
您需要返回函数,
App
常量包含调用WrapFooter
后形成的对象。因此,您只需要使用一个闭包,以便WrappedComponent
在WrapFooter
范围内可用。尝试使用下面这样的片段
是片段的简写符号,而不是数组