Abdulaziz Jama
Abdulaziz Jama

Reputation: 11

How to solve this unexpected use of comma operator?

Just wondering how to resolve this, little new to react btw.

<button className="btn btn-light register-button" onClick={this.Subscribe, () => {sweetalertclick();}} 
                                type="submit" style={{ width: '50%' }} disabled={!allValid}>Subscribe</button>

Upvotes: 0

Views: 324

Answers (1)

CertainPerformance
CertainPerformance

Reputation: 370989

You'll need to call .Subscribe and sweetalertclick separately.

onClick={(e) => {
  this.Subscribe(e); // if .Subscribe doesn't take an argument, you can omit the `e`
  sweetalertclick();
}}

Upvotes: 2

Related Questions