Closed fcollignon closed 6 years ago
If "activeItem" property is set by an external action after rendering of SideMenu, the display of new "Item" is not updated.
Basic example :
`import React, {Component} from 'react'; import {SideMenu, Item} from 'react-sidemenu';
export default class PortalSideMenu extends Component { constructor(props) { super(props); this.changeItem = this.changeItem.bind(this); this.state = { activeItem:'/dashboard/requests' } }
changeItem(item) { this.setState({activeItem: item}); } render() { return ( <div> <button onClick={() => this.changeItem('/dashboard/tasks')}>Change</button> <h4>{this.state.activeItem}</h4> <SideMenu activeItem={this.state.activeItem}> <Item label="Dashboard" icon="fa-tachometer"> <Item label="Tasks" value="/dashboard/tasks" icon="fa-folder-open"/> <Item label="Requests" value="/dashboard/requests" icon="fa-folder-open"/> </Item> </SideMenu> </div> ); }
}`
Implemented in 0.0.14.
If "activeItem" property is set by an external action after rendering of SideMenu, the display of new "Item" is not updated.
Basic example :
`import React, {Component} from 'react'; import {SideMenu, Item} from 'react-sidemenu';
export default class PortalSideMenu extends Component { constructor(props) { super(props); this.changeItem = this.changeItem.bind(this); this.state = { activeItem:'/dashboard/requests' } }
}`