无法使用{<item.element/>}的形式
来源:8-6 创建页面路由,制定接口规范(上)

Ho_gg
2023-06-03
老师,这里element我无法使用{<item.element/>},会提示Type ‘Element | (() => Element) | FC<{}>’ is not assignable to type ‘ReactNode’. Type ‘() => JSX.Element’ is not assignable to type ‘ReactNode’.ts(2322) components.d.ts(62, 5): The expected type comes from property ‘element’ which is declared here on type ‘IntrinsicAttributes & RouteProps’。如何解决?
3回答
-
weixin_慕田峪0594011
2023-12-15
import { Button, Result } from 'antd';import React from 'react';
const Page404: React.FC = () => ( <Result status="404" title="404" subTitle="Sorry, the page you visited does not exist." extra={<Button type="primary">Back Home</Button>} />);export default Page404;
我也遇到同样的问题 加这个就可以了 React.FC
00 -
黑石
2023-06-03
需要贴一下你的代码,报错地方的代码。
00 -
Ho_gg
提问者
2023-06-03
应该是跟我含有Navigate的问题
00
相似问题