map array of names and pass callback into it

const BUTTONS = ['Default', 'Primary', 'Success', 'Info', 'Warning', 'Danger']; function renderDropdownButton(title, i) { return ( <SplitButton bsStyle={title.toLowerCase()} title={title} key={i} id={`split-button-basic-${i}`} > <MenuItem eventKey="1">Action</MenuItem> <MenuItem eventKey="2">Another action</MenuItem> <MenuItem eventKey="3">Something else here</MenuItem> </SplitButton> ); } const buttonsInstance = ( <ButtonToolbar>{BUTTONS.map(renderDropdownButton)}</ButtonToolbar> ); render(buttonsInstance);

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.