This article will focus on setting up dynamic routing in React. Previously, I explained how to fetch data from an API and display it in the browser using React Hooks and Axios. By the end, we were able to create a Featured Products page displaying the fetched data:
This article will focus on fetching data from an API and displaying it in the browser. This will be done using React Hooks. To keep things simple, we will be using a shopping API that I created for this article. However, the steps laid out here can be applied when fetching and displaying data from any API, whether it be a third-party API like the OMDb API or your own.
Let’s take a look at what we will set out to achieve. Imagine that we have a website with a Featured Products page where we want to display our top…
Before going into how to create objects, let’s take a look at some terms that are used when talking about objects. Objects are written inside curly braces, as in the example shown below. The object in this example is stored in a variable called
person1, and can be referred to as the person1 object. Properties tell us about the object. Here, the properties are
DOB (date of birth). …
When you declare a function (called a function declaration), you use the
function keyword, followed by the name of the function that you give it. Next, comes a list of parameters that the function needs…
Have you ever wondered how to control the content that is displayed when you post a link to your app or website on social media, like Facebook? Or for that matter, how to even display any content?
You may have shared a link to your app or website on social media before, only to have it look like this. It doesn’t look very appealing, nor does it give much information about what the content is about.
When you create a website or web application using regular HTML, the
<title> tag is what you use to define the title for your HTML document. So, for example, if you have a portfolio website, the
<title> tag up in the
<head> of your landing page’s HTML code may look something like this:
<title> tag on your About page may look something like this:
<title>My Portfolio | About</title>
Whatever title you have here will then be shown exactly as it is in the browser’s title bar or in the page’s tab.
In this article, I’m going…