Pratham Profile picture
30 Sep, 16 tweets, 3 min read
Introduction to React βš›οΈ

React is a JavaScript library for building UI components. The ecosystem of React is really immense which eventually makes it one of the best front-end libraries.

πŸ§΅πŸ‘‡πŸ»
Why React?

1. Reusable components
2. Fast due to virtual DOM
3. Huge ecosystem
A typical React app contain many components. They are reusable and can interact with each other.

What is a component?
- Component as a simple function that you can call with some input and they render some output
Attached image showing a typical React app with all different components.
As you can see this entire webpage is nothing but the mixture of different components
Components are of two types:

1️⃣ Class based components
2️⃣ functional based components

Class-based components are defined using ES6 classes, whereas function components are basic JavaScript functions
Before diving deeper into it, let's talk a little bit about JSX

- JSX stands for JavaScript XML. It's basically nothing but the extension of JavaScript which allow us to write HTML code in JavaScript file.
const element = <h1>Hello, world!</h1>;

Consider this variable declaration. It's neither JS nor HTML. This is the mixture of JavaScript + XML = JSX
Now we know JSX, let's move forward

- Functional components are nothing but simply a JavaScript function which takes some parameter will return some JSX code

A typical function component πŸ‘‡πŸ»
A very important concept in React

Virtual DOM

You might have heard the term "DOM", virtual DOM is kind of similar. It uses a strategy that updates the DOM without having to redraw all the webpage elements
Every time the DOM changes, browser need to recalculate entire layout and then repaint the web page which makes a web app slow.

To overcome this we have virtual DOM
Every time the state of our application changes, the virtual DOM gets updated instead of the real DOM
Whenever the new element is added to the UI, a new virtual DOM associated with that element is created. If state of this element changes, a second new virtual DOM is created which will be compared with the previous virtual DOM

- It then updates ONLY the object on the real DOM
Setting up your first react project directory is quite confusing. Let's see how you can do it

I'm assuming you have node environment set up and up-to-date version of npm. If no, download it from here

nodejs.org/en/
Next thing you need to install is `create-react-app` is a tool helps you start building with React app. It set up all the tools that you need in order to get started
Now you have create-react-app installed in your machine, it's time to create your first React app

Command - "create-react-app app-name"

Depending upon your internet speed, this will take some minutes. So time to prepare a coffee for yourself β˜•
Once done, run "npm start"

Your default browser will launch automatically and you will see something like this at localhost:3000
And that's it. You just created your first react app. I tried my best to give a quick overview of how things work in React

If you like this thread, drop a like and retweet, means a lot to me ❀️

Peace out πŸ˜‰

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Pratham

Pratham Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Prathkum

28 Sep
Five great icons websites for every web developer and designer ⏺️

Thread πŸ§΅πŸ‘‡πŸ»
1️⃣ Icons 8

- Icons8 is just more than icons. You can download illustrations, vector images, music and much more

πŸ”— icons8.com
2️⃣ Icon Monstr

- Black and white themed minimal icons which looks super great. You can also cuatomize the thickness

πŸ”— iconmonstr.com
Read 6 tweets
18 Sep
Top 5 free APIs for web developers

πŸ§΅πŸ‘‡
1️⃣ Custom Search API

- Create your own custom search engine. You can search for image, videos, and news.

πŸ”— RapidAPI.com/contextualwebs…
2️⃣ Movie Database API

- Access movie and TV information similar to that of IMDB.

πŸ”— RapidAPI.com/rapidapi/api/m…
Read 7 tweets
27 Aug
JavaScript is an enormous language but you don't need to learn everything in the beginning.

Here is the detailed explanation on JavaScript for Web Development πŸ§΅πŸ‘‡πŸ»
JavaScript is a kind of language that as you progress deeper in the field, you will come to know a lot more cool concepts about it.

Prerequisites if you want to learn JavaScript for web development πŸ‘‡πŸ»

- HTML
- CSS
First and foremost, it's a programming language so you should know about basic programming concepts:

- Data types in JavaScript
- Variables
- Statements
- Control statements
- Operators
- And other basic stuff....
Read 19 tweets
30 Jul
5 great code snippet websites for every web developer and designer

πŸ§΅πŸ‘‡πŸ»
1️⃣ 30 Seconds of Code

- Short code snippets for all your development needs

πŸ”— 30secondsofcode.org
2️⃣ Free Frontend

- Free hand-picked HTML, CSS and JavaScript (jQuery, React, Vue) code examples, tutorials and articles

πŸ”— freefrontend.com
Read 6 tweets
23 Jul
Some of my best threads of web development that led me to over 100,000 audience.

πŸ§΅πŸ‘‡πŸ»
1. JavaScript for Web Development β˜•

2. Long and detailed explanation of CSS Grid Layout

Read 8 tweets
13 Jul
Have you found the "z-index" a confusing concept of CSS?

Don't worry, the next 6 tweets will solve all of your doubts.

πŸ§΅πŸ‘‡πŸ»
z-index is a CSS property that controls the stacking order of elements along the z-axis.

Image a hypothetical line starting from your eye to screen, that is z-axis
Note that z-index only works on positioned elements.

You need to specify the position (relative, absolute, sticky, fixed) if you want to arrange an element using z-index
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(