Okay to create Toast(s) on the fly?

Is there any issue with doing the following for infrequent Toast messages?

app.toast.create({
  text: 'Top positioned toast',
  position: 'top',
  closeTimeout: 2000,
}).open();

The above is done instead of creating a var. Should I do the above OR create a single global Toast and just change the text message every time before telling it to open?

I would rather not create a unique Toast object for every app message I need to give to the user.

Thanks!

1 Like

Yes, it is totally ok to do this. Better add also destroyOnClose: true parameter

3 Likes