Reactjs 我找不到“我不知道”;资源“;输入React Admin(typescript)
我在用电脑。 我的项目正在使用类型脚本 我正在尝试通过更新布局来创建自定义菜单,如下所示:Reactjs 我找不到“我不知道”;资源“;输入React Admin(typescript),reactjs,typescript,react-admin,Reactjs,Typescript,React Admin,我在用电脑。 我的项目正在使用类型脚本 我正在尝试通过更新布局来创建自定义菜单,如下所示: const AppLayout = (props: JSX.IntrinsicAttributes) => ( <Layout {...props} appBar={AppBar} sidebar={Sidebar} menu={Menu} notification={Notification} /> ); import { Th
const AppLayout = (props: JSX.IntrinsicAttributes) => (
<Layout
{...props}
appBar={AppBar}
sidebar={Sidebar}
menu={Menu}
notification={Notification}
/>
);
import { Theme, useMediaQuery } from "@material-ui/core";
import LabelIcon from "@material-ui/icons/Label";
import DefaultIcon from "@material-ui/icons/ViewList";
import React, { FC } from "react";
import { getResources, MenuItemLink } from "react-admin";
import { useSelector } from "react-redux";
import { AppState } from "../../../consts/types";
interface Props {
logout: () => void;
onMenuClick: () => void;
}
const Menu: FC<Props> = ({ onMenuClick, logout }) => {
const isXSmall = useMediaQuery((theme: Theme) =>
theme.breakpoints.down("xs")
);
const open = useSelector((state: AppState) => state.admin.ui.sidebarOpen);
const resources = useSelector(getResources);
return (
<div>
{resources.map((resource) => (
<MenuItemLink
key={resource.name}
to={`/${resource.name}`}
primaryText={
(resource.options && resource.options.label) || resource.name
}
leftIcon={resource.icon ? <resource.icon /> : <DefaultIcon />}
onClick={onMenuClick}
sidebarIsOpen={open}
/>
))}
<MenuItemLink
to="/custom-route"
primaryText="Miscellaneous"
leftIcon={<LabelIcon />}
onClick={onMenuClick}
sidebarIsOpen={open}
/>
{isXSmall && logout}
</div>
);
};
export default Menu;