I am using react bootstrap dropdown menu https://react-bootstrap.github.io/components.html#btn-dropdowns. pullRight and pullLeft allows us to align the position of the menu .
I do not know the width of the menu items initially. I need to calculate on run time and conditionally align the dropdown items (pass the props pullLeft/pullRight to DropdownButton) . The children (MenuItem) are visible none when the drop down loads, only on button click I get the height.
My question is that, do I need to calculate the height on click and re-render the entire DropdownButton component? Any better way to pass the prop to DropdownButton component without re rendering?
<DropdownButton
buttonClassName={buttonAttrs.className}
pullLeft
onClick={this.callToggle}
bsStyle={(metadata.displayStyle === 'button' ? 'button' : 'link' )}
noCaret
title={title}
key={"0"}
id={"test"}
>
{this.renderChildren().map((child, index) => {
return (<MenuItem eventKey={index}>{child}</MenuItem>)
})}
</DropdownButton> : <button {...buttonAttrs} ref="button">
pullLeft. It's justpullRight={true|false}.