import React, { Fragment } from "react"; import { Redirect, Route, Switch, useRouteMatch, useHistory, } from "react-router"; import { Nav } from "react-bootstrap"; import { UserWithToken } from "@/services/user"; import UserAdmin from "./UserAdmin"; interface AdminProps { user: UserWithToken; } const Admin: React.FC = (props) => { const match = useRouteMatch(); const history = useHistory(); type TabNames = "users" | "more"; const tabName = history.location.pathname.replace(match.path + "/", ""); function toggle(newTab: TabNames): void { history.push(`${match.url}/${newTab}`); } const createRoute = ( name: string, body: React.ReactNode ): React.ReactNode => { return (
{body} ); }; return ( {createRoute("users", )} {createRoute("more",
More Page Works
)}
); }; export default Admin;