Now for the fallback here on the favorites screen and it of course matters to us whether we have favorites
or not. So we can render a fallback here in a very simple way by not rendering the meal list
if fav meals, if this array is empty. So all we need to do here in the favorite screen component is we
can check if fav meals length is equal to zero let's say,
which means we have no favorite meals or that can't really happen in this app
but if for some reason fav meals is false-ish which is what this checks,
so if it's not set,
if either of these two things is true, then I will not return my meal list but a view with let's say
a text in there where I say no favorite meals found, start adding some
and now let's actually be clear about the casing here. So that's the text I could render as a fallback.
Now important, since I use view and text, we need to import this,
so view and text from React Native should be imported here,
otherwise we'll get an error and now we can add some styling here with let's say styles.content
or whatever you want to name it, import stylesheet from React Native therefore and now let's
add a stylesheet here right before the export styles with stylesheet.create
and in there, add this content key we're referring to with flex one and then just as we did it before,
justify content center and align item center to center all content vertically and horizontally.
So this is the content style property which I apply to this view and
with this, we show this text.
Now of course instead of using text, we could actually also use our default text
now that I think about it, that's what we have it for, the default text which uses our font from components
default text.
So let's use default text here instead of the built-in text component to have our default font
and now if we save this, what we have is this text here,
we have no favorites.
As soon as we start adding some,
so if we add these two items here as favorites for example, we'll of course see those and only if we
remove both here, we'll see the fallback text again.
So that works like a charm.