First lets establish a little bit of basic information regarding server interaction and why you would want to use something like a fetch request. Communicating with online servers allows you to access raw data that's arranged in the form of objects and arrays online through API's (Application Programming Interface). I will also briefly cover what an API is as we will be using one in our example below to demonstrate how to use fetch requests.
Let's show a simple example of how to accomplish linking our local client to an API server using a fetch request. For this example we'll use a Star Wars API provided at https://swapi.dev/api.
This second and third line of code that we have added allows us to render the API's response into something readable to us as the user. We use arrow syntax here to make sure that the object (The API in this instance) is returned and passed to our next then() and the console.log() will print the object to our console.
This method of fetching our data from servers, regardless of where they are hosted, is known as the Response.json() method and according to developer.mozilla.org/ this method " ...takes a Response stream and reads it to completion. It returns a promise which resolves with the result of parsing the body text as JSON.