I think there is something to be said about how a .then reads a bit better, but this can be argued both ways. Either example takes advantage of the language to do one thing: fetch data.
In most scenarios, you would have a helper function anyway, which is essentially what you wrote (I would just rename it to something like fetchUsers()).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Definitely more concise!
I think there is something to be said about how a
.then
reads a bit better, but this can be argued both ways. Either example takes advantage of the language to do one thing: fetch data.In most scenarios, you would have a helper function anyway, which is essentially what you wrote (I would just rename it to something like
fetchUsers()
).