ReactJS, MongoDB, JS, CSS in one shot while building an App
Tags: react, webdev, tutorial, javascript
Published: 2023-06-23 13:08:08

🤝 In today's era of AI, when it became so hard to predict that "Will Web Dev survive". People are still focusing on learning things like HTML, CSS, JS to 100% and then moving on to the new things without building anything using the things that they learnt earlier.

![Programming memes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/025hrzjy21580tm3d6sv.png)

😩 In today's world where there are so many sources like ChatGPT, Documentation etc, People are still building projects by watching tutorials.

One should focus more on building rather than spending too much time on a language or framework learning.

## 📌 Let's Jump in
Today we'll see only the necessary things that one needs to get started with web development like knowing necessary stuff of HTML, CSS, JS and ReactJS and using MongoDb.

If you want to refer to the video with Project, Refer to this [Youtube video](https://youtu.be/0RWB1kHLrEQ) (Only video you'll ever need to start with web development)

## ✨ HTML

HTML is called Hyper Text Markup Language which is a structure of arranging text in opening and closing tags.
for ex:-
```HTML
<div>
   <p>Hello</p>
</div>
```
Like above, we have opening tags <> and closing tags </> which gives a certain functionality to the text. 
- Like div tag here means a box 
- and p tag means a paragraph tag.

⚡️ Necessary tags for HTML starters:-
- Heading Tags
```HTML
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
```

- Container tags
```HTML
<div>I am a Container</div>
<span>I am an inline element</span>
<p>This is a paragraph tag</p>
<pre>This is a pre tag which will render text as written</pre>
<code>This is a tag for rendering a code block</code>
```

- Document tags
```HTML
<head>Tag for providing head information like website heading on the tab and icon on the tab</head>
<title>To be included in the head tag for title information</title>
<link> tag for setting up the relation with any external document
<meta> tag for providing some keywords, description about a website and also useful in SEO (Search Engine Optimisation)
<style>Tag to include the styling for the html page using CSS rules</style>
```

- Section tags

```HTML
<header>used to give introductory information about the document like header information in the top</header>
<nav>it is self explanatory from its name. Used for navigation bar specifically</nav>
<section>A general tag for a section in the document.</section>
<footer>Used to represent the footer in the document</footer>
```

- Text formatting tags
```HTML
<b>To make the text bold</b>
<i> To make font italic</i>
<em>To put emphasis on the specific text</em>
<strong>To represent text with strong focus, generally shown bold</strong>
<sub></sub> <sup></sup> Used for subscript and superscript
<time>used to represent a period of time</time>
```

- List tags
```HTML
<ul>unordered list. It is generally rendered as with bullet points</ul>
<ol>Ordered list which is generally represented as with numbers</ol>
<li>for a list item of a ul or ol</li>
```

- Table tags
```HTML
<caption>specifies the title or caption of the table</caption>
<table>To define a table</table>
<thead>to provide some content for the table head</thead>
<tbody>used to give data for the table</tbody>
<th></th> and <td></td> used to give table head and table data to our table
```

- Form tags
```HTML
<form>used for defining a form with submission flow</form>
<input>Used for getting the input from the user</input>
<textarea>used for getting text input which is resizable</textarea>
<button>Used to specify a button element which can be clicked</button>
```

## ✨CSS
CSS is called cascading style sheets which is used to give styles to the plain HTML text document. Like giving colors, background-image, padding, margin etc.

In CSS, one needs to know margin, padding, flex, grid, colors, absolute and relative position.

- Margin of a div container from its parent container

![Margin CSS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7lxanaca1ryky5pv0ac.png)

- Padding in CSS means pushing content of div container relative to its container only instead of its parent container like in margin

![Padding CSS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvaxacjl82t2uerxlcv5.png)

- Then we have flex property which can be adjusted row wise or column wise

![display flex](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4r39zl8sefke4t16cfun.png)

It has some other properties like justify-content and gap

![flex box cheat sheet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/79ku8qc1zh82yvly3nfd.png)

- Now we have two positions absolute and relative

![Absolute Position](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwbleroqu027fwhbmka2.png)

![Relative position](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y8dhwdox6lhxv4dr2o2k.png)

## 📍 JS (Javascript)

🚀 Now Java script is a language that is being used for giving functionalities like sending data to the DB, registering mouse events and doing something like submitting a form.

🔥 JS is used to manipulate the DOM (Document Object model) to add or remove any html elements or change the css properties like clicking a button changes the theme dark or light.

- Let's start with a simple HTML template
```HTML
<!DOCTYPE html>
<html>
<head>
  <title>Introduction to JavaScript</title>
  <link rel="stylesheet" href="styles.css">
</head>
<body>
  <h1>Welcome to JavaScript!</h1>
  <p id="demo">This is a demonstration paragraph.</p>

  <script src="script.js"></script>
</body>
</html>
```

- Now let's print something in our console
```JAVASCRIPT
// script.js

// Outputting a message to the browser console
console.log("Hello, JavaScript!");

// Modifying HTML content
document.getElementById("demo").innerHTML = "This paragraph is updated by JavaScript!";

```

- Now, let's include the JS script inside it
```HTML
<script src="script.js"></script>
```

- Now let's add button and an event listener of mouse
```JAVASCRIPT
<button onclick="changeText()">Click me</button>
```

- Now, let's call a function when button is clicked

```JAVASCRIPT
// script.js

function changeText() {
  document.getElementById("demo").innerHTML = "Button clicked!";
}
```

✨ Here, we are using **"document"** and getting element by the attribute **"id"** given to the paragraph. This document is the object referring to the DOM (Document Object Model).

![DOM in JS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jnj1dxcyed8p9038k0g3.png)

## 🤝 ReactJS

🚀 JS is a vast language which should be explored while building a project. And after that one can jump to ReactJS which is a framework built for Reusability, Scalability and Rendering only those changes which are being added into the DOM or being removed. Because ReactJS uses Virtual DOM and a Real DOM. So, ReactJS uses an exact copy of the real DOM and when some changes happen in the dom then react compares the changes of virtual dom with real dom.

And renders only the changes that are made into the DOM. While Simple JS re-renders the whole Document from top to bottom of the DOM.

Now, In next Blog (Part 2) We'll see How React works, How to use DB like MongoDB and how to use React architectures like Redux.

Meanwhile you can refer to this [Youtube video](https://youtu.be/0RWB1kHLrEQ) which is a single video that you'll need to jump into the Web Development.