React 18

Last Updated: 9/24/2023

What is React

  • React is a JavaScript library for building dynamic and interactive user interfaces
  • It was created at Facebook in 2011 and is currently the most widely used JavaScript library for front end development.

Why React

  • When a web page loaded in a browser, the browser takes the HTML code and creates a tree like structure called the Document Object Model (DOM). This allows us to use JavaScript and change the page content in response to user actions.
  • For example, we can use JavaScript to hide an element when a button is clicked. This is called vanilla JavaScript, meaning plain JavaScript code without any third party tools.
  • As our applications grow, working with the DOM can become quite complex and challenging to manage. This is where react comes into play.
  • In React applications, we don’t query and update the DOM. Instead, we describe our page using small, reusable components.
  • React will take care of efficiently creating and updating DOM elements.
  • Components help us write reusable, modular and better organized code.

Typescript

Typescript

  • Superset of JavaScript
  • Adds static typing to the language
  • Helps to catch errors earlier in the development process

Sample Website

Eg Youtube Navbar Sidebar Grid Card Like

  • We can build all these components individually, and then combine them to build the page.
  • Essentially, a React application is a tree of components with the app being the root, bringing everything together.