Getting Data from the Server
We need data to fill the items in our menu and sub-menu. For this purpose, we'll have to use JavaScript to connect to the server and fetch data.
We'll cover the following...
In a real application, the values in the dropdown menu might not be hardcoded. For example, the image might change depending on which items are advertised more heavily on a given day (or even for the particular user).
How to Fetch Values?
For values that come from a server, we usually need JavaScript (note: that’s not always the case. For example, you can fetch an image from an endpoint that serves different images depending on the request or other factors).
Since we are talking about creating components, we won’t be building or standing up an actual ...