reactjs - React material-ui MenuItem containerElement not working -
i have following code:
<menuitem primarytext="home" containerelement={<link to="/" />} />
but doesn't work explained in other topics/threads menuitem discussed here material ui menu using routes. once add containerelement prop menuitem i'm getting exception:
uncaught error: element type invalid: expected string (for built-in components) or class/function (for composite components) got: undefined. forgot export component file it's defined in. check render method of `enhancedbutton`.
it looks no longer works (will need find change log.)
to fix did npm install react-router-dom --save
, used following snippet:
import react, { component } 'react'; import { navlink } 'react-router-dom' import menu 'material-ui/menu'; import menuitem 'material-ui/menuitem'; import drawer 'material-ui/drawer' <drawer docked={false} open={this.state.open} onrequestchange={(open) => this.setstate({open})}> <menuitem ontouchtap={() => {this.handleclose()}} > <navlink to="/">home </navlink> </menuitem> <menuitem ontouchtap={() => {this.handleclose() }} > <navlink to="/about"> </navlink> </menuitem> </drawer>
Comments
Post a Comment