import React from "react"; import { useRouter } from "next/router"; import { AppBar, Tabs, Tab } from "@material-ui/core"; import routes from "../routes"; const TopAppBar = () => { const router = useRouter(); const pathname = ( routes.find(({ pathname }) => pathname === router.pathname) || { pathname: "/" } ).pathname; return ( { router.push(value); }} variant="fullWidth" indicatorColor="primary" textColor="primary" > {routes.map(({ pathname, icon }) => ( ))} ); }; export default TopAppBar;