Skip to content
Advertisement

Passing multiple actions to onClick event in a react-bootstrap Button

Consider a react/redux application with react-bootstrap components.

This may be a very rookie question, but I am trying to pass multiple actions to a single onClick event on a Button from a react-bootstrap library.

<Button bsStyle="success" bsSize="small" onClick={someCallback; someOtherCallback;}>
  Something
</Button>

How to do this properly?

Advertisement

Answer

Wrap them in another function:

<Button bsStyle="success" bsSize="small" onClick={onButtonClick}>
  Something
</Button>
...
onButtonClick = function(event){
  someCallback()
  someOtherCallback()
}
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement