-4

I have:

one = () => {
   //do something
}
two = () => {
   //do something
}

<div>
   <button onClick={/*this.one, this.two  (it doens't work)*/}>Go</button>
</div>

How can i call two functions using just one onClick?

2 Answers2

-1

Try:

<div>
   <button onClick={this.one; this.two}>Go</button>
</div>
lorenago
  • 415
  • 4
  • 12
-1

How to call multiple JavaScript functions in onclick event?

one = () => {
   //do something
}
two = () => {
   //do something
}

<div>
   <button onclick="one();two();">Go</button>
</div>


mrQubeMaster
  • 342
  • 2
  • 14
  • 1
    If you see a duplicate of a question, please don't answer the question. Instead, please flag the question as a duplicate. – Heretic Monkey Feb 06 '19 at 14:02