If a network call returns an empty list, that should be rendered differently than a list with elements in it. We’ll create two substates of the http success state (withData and withoutData) and choose which substate to transition to based on the http response using an automatic transition and a guard.
In the video is missing when updates the implementation of hasData
guard, because now is necessary to check the ctx
not the event
parameter cause the guard is not called by an event.
I seem to have to use guards:{ hasData: (ctx, event) =>{ console.log(event) return event.data && event.data.count > 0 } }
You are right, the video misses the part about updating guard!