samedi 8 janvier 2022

Is it a good way to call API calls from component classes in emberjs?

I am learning emberjs right now and i was wondering if it is a common way to make fetch request inside a function (for example for button clicks) in component classes and store the data in the class component. For example:

export default class ExampleComponent extends Component {
  @tracked items;
  @action async toggleCall() {
    await fetch(...)
    .then(...)
  }
}

Or do you do this in a different way in emberjs?




Aucun commentaire:

Enregistrer un commentaire