reactjs - How to create dynamic elements in material-ui popover? -


how create dynamic elements in material-ui popover? want example it.

class mypopover extends react.component {     constructor(props) {         super(props);         this.state = { popoveritems: [] };     }      componentdidmount() {         ... fetch popover items ...         ... set state ...     }     render() {         return (             <muithemeprovider>                 <popover                     open={this.state.open}                     anchorel={this.state.anchorel}                     anchororigin={{horizontal: 'left', vertical: 'bottom'}}                     targetorigin={{horizontal: 'left', vertical: 'top'}}                     onrequestclose={this.handlerequestclose}                 >                     <menu>                         {this.state.popoveritems.map( (item) => {                             <menuitem primarytext={item.name} />                         })}                     </menu>                 </popover>             </muithemeprovider>         )     }  } 

you can fetching onclick or other events example fetches items 1 time when component mounted.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -