import { observer } from "mobx-react"; import * as React from "react"; import { Link } from "react-router-dom"; import { Menu } from "semantic-ui-react"; import * as route from "@client/routePaths"; import { AppState, ConsumeState, injectState } from "@client/state"; interface NavItemProps { to: string; children: React.ReactNode; } const NavItem = observer(({ to, children }: NavItemProps) => { function consumeState(appState: AppState) { const { location } = appState.routerStore; return ( {children} ); } return {consumeState}; }); function NavBar({ appState }: { appState: AppState }) { let loginMenu; // tslint:disable-next-line:prefer-conditional-expression if (appState.isLoggedIn) { loginMenu = Logout; } else { loginMenu = Login; } return ( Devices Messages test {loginMenu} ); } export default observer(injectState(NavBar));