We did add logic to load our ingredients
and by the way, if you're wondering why the salad is at the bottom, that happens because since we loaded
from firebase and there we can't order the properties manually, the salad is ordered at the bottom alphabetically
.
and therefore, it's at the bottom here
too. You would simply have to adjust your code to manually turn your ingredients let's say into not just
a number as a value but an object where you also define the position and then you would have to adjust
your frontend code to take care about this position too or you of course simply choose a solution where
you hard code your ingredients and don't set ingredients equal to the ingredients you get back from
the server
but to a javascript object where you then manually map salad to action.ingredients.salad and so
on, this of course then loses a bit of the flexibility you had before where you could simply take advantage
of setting up anything and then using it in your frontend app, though you never had all that flexibility
anyways because we have only a limited amount of ingredients supported with our css code here and
the ingredients property where we also have a switch case statement.
So just to complete that thought here, we can reach out to action.ingredients.cheese and so on here to map
this one by one when we set the ingredients, also with the meat of course and with all that added, you
would see that now if we save this and go back to the application and start adding salad and so on, the
order is correct again because now, we're mapping this manually.
Again the downside is since we have to do this, we really only support these four ingredients but we're
doing this anyway in our application
as I just said, for example in the ingredients component, in the burger area here where we also have a
switch case statement where we also only support a limited amount of components.
So this is the case anyways and now at least, the ordering is back to where it was before.
So this is one possible improvement, purely optional
just wanted to make sure you are not confused why the salad is at the bottom.