{
shouldComponentUpdate(nextProps) {
return nextProps.opened !== this.props.opened;
}
// clickOn returns a click event handler function for the given menu item.
clickOn = menu => (event) => {
event.preventDefault();
this.props.changeContent(menu);
};
// menuItems returns the menu items corresponding to the sidebar state.
menuItems = (transitionState) => {
const {classes} = this.props;
const children = [];
MENU.forEach((menu) => {
children.push((
));
});
return children;
};
// menu renders the list of the menu items.
menu = (transitionState: Object) => (
{this.menuItems(transitionState)}
);
render() {
return (
{this.menu}
);
}
}
export default withStyles(themeStyles)(SideBar);