Day 22 of My Web Development Journey ๐ | Meta Tags and Introduction to React.js
Today, I learned about HTML meta tags and started exploring React.js. I also learned the difference between a library and a framework and how to set up a React project using the terminal. 1. What Are Meta Tags in HTML? Meta tags provide information about a webpage to browsers and search engines. They are placed inside the section of an HTML document. Example <head> <meta charset="UTF-8"> <metaโฆ
On the 22nd day of my web development journey, I delved into the concepts of HTML meta tags and began exploring React.js. I also learned the distinction between a library and a framework and how to set up a React project using the command line interface.
1. What Are Meta Tags in HTML? Meta tags serve as information about a webpage for browsers and search engines. They are embedded within the section of an HTML document. For instance:
```
head
meta charset="UTF-8"
meta name="viewport" content="width=device-width, initial-scale=1.0"
meta name="description" content="My web development learning journey"
title My Website
/head
```
- The `charset` attribute supports a wide range of characters.
- The `name="viewport"` attribute ensures webpages display correctly on different screen sizes.
- The `name="description"` attribute provides a concise description of the webpage.
- The `title` element defines the title shown in the browser tab.
2. Introduction to React.js
React.js is a JavaScript library designed for building user interfaces, particularly interactive web applications.
- React enables developers to partition a webpage into reusable components.
- For example, an e-commerce website might have distinct components for a navbar, product cards, shopping cart, and footer.
- Instead of repeatedly writing the same UI code, components can be reused.
- React.js is a library that aids in constructing user interfaces.
3. What Is a Library?
A library is a collection of pre-written code pieces that assist developers in accomplishing specific tasks.
- React.js, for instance, is a library used for building user interfaces.
- Developers decide when and where to incorporate the library into their application.
4. What Is a Framework?
A framework presents a comprehensive structure for developing an application and frequently dictates how various parts of the application should interact.
- Angular and Next.js are examples of frameworks, although Next.js is specifically a React framework.
- Libraries, in contrast, offer specific functionalities that developers can call upon as needed.
5. Installing React Using the Terminal
To initiate a React project, I commenced by verifying the installation of Node.js and npm via the command line:
```
node -v
npm -v
```
Next, I generated a React project using Vite, specifying the React template:
```
npm create vite@latest my-react-app -- --template react
```
Subsequently, I navigated to the project directory:
```
cd my-react-app
```
I installed the necessary dependencies:
```
npm install
```
Finally, I launched the development server:
```
npm run dev
```
The terminal displayed a local URL that I could access in my browser to view the React application. Throughout this day, I acquired insights into HTML meta tags, the fundamentals of React.js, the differentiation between libraries and frameworks, and the process of establishing a React project using the terminal.
Written by urgent.news from Dev.to's reporting โ not their text. Machine-written โ may contain errors; check the original before relying on it.