react-bootstrap/react-bootstrap — pull request #139 by pieterv (2014-07-01 09:23:43+00:00)
Title: Only pass through onSelect handler if it has been set on the DropdownButton

This change loops over the children and uses `cloneWithProps` to only set the onSelect handler if one has been specified on the component or its child. The `MenuItem` components will call `preventDefault` if a onSelect handler is passed, as it assumes the resulting action will be handled via the user and not the browser, this change therefore is necessary to make sure we don't pass the onSelect handler unless we are sure the user does intend to handle the action.

Fixes #138

@stevoland to CR

@spicyj if you have a second :) it would be good to get your opinion on whether the current approach we are taking with `cloneWithProps` is sane (as in we are using it a lot), is there a significant performance impact of cloning components? With this change the child `MenuItem`'s will each be cloned 2 times before being rendered (once here and once in `DropdownMenu` component). Also is there be any side effects of passing key's and ref's down?