In real life you should rather try to use a boolean `loading` state variable which is set to `true`…
Thomas Andersen

Good point. In my version, empty data would result in infinite loading. I guess the other method would be (assuming you have control of the back end) to have your API send some type of “zero results” message. But in general, I think your way is the best practice. I need to update my post now. :)

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.