我试图实现的是根据路由url呈现不同的内容周围视图。我在用react-router。
const App = React.createClass({
render() {
return (
<div> //this is when Login component
{this.props.children}
//something like this when it is any page except login
<Sidebar />
{this.props.
当我点击任何菜单选项时,我正试图让我的侧边栏关闭。每当我点击汉堡图标时,我都可以让侧边栏关闭/打开,但我不确定是否应该让我的侧边栏组件成为一个类,并拥有自己的状态。下面是我的导航和侧边栏组件。
import React from 'react';
import { Link } from 'react-router-dom';
import { ReactComponent as MenuIcon } from '../../assets/menu.svg';
import { ReactComponent as CloseIcon } from