Pratham Profile picture
20 May, 18 tweets, 4 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 πŸ˜‰
You can start learning React right now but basic understanding of programming and HTML can make the process easier

Here are some important concept of JavaScript you can learn before diving into React

I just converted this thread into a @hashnode article

pratham.hashnode.dev/are-you-planni…

β€’ β€’ β€’

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

21 May
I have created countless number of Twitter headers using CSS

Here are my top 6 creations πŸ§΅πŸ‘‡πŸ»
1️⃣ A programmer desk

πŸ”— codepen.io/prathkum/pen/w… Image
2️⃣ Rocket producing fumes

πŸ”— codepen.io/prathkum/pen/V… Image
Read 7 tweets
20 May
I created numerous number of handmade CSS cheat sheets and notes

I chose a few that might work for you πŸ§΅πŸ‘‡
1. Box Model
2. CSS Selectors
Read 13 tweets
19 May
I have created 5 single div CSS icons which are so simple that anyone can try them

πŸ§΅πŸ‘‡
1. Yin and Yang ☯️
2. Star ⭐
Read 7 tweets
18 May
Some of my handmade JavaScript notes and cheat sheets that can help you πŸ§΅πŸ‘‡
1. JavaScript Function Anatomy
2. JavaScript Arrow Function
Read 11 tweets
18 May
5 amazing GitHub repositories for every React developer

🧡 πŸ‘‡πŸ»
1️⃣ Beautiful React Hooks

A collection of beautiful and (hopefully) useful React hooks to speed-up your components and hooks development

πŸ”— github.com/beautifulinter…
2️⃣ React cheat sheet

Cheatsheets for experienced React developers getting started with TypeScript

πŸ”— github.com/typescript-che…
Read 6 tweets
18 May
Glassmorphism is a unified name for the popular frosted Glass design. It is trendy web design nowadays which looks super cool

Let's create a glassmorphic form using few simple CSS steps

A thread 🧡
Few days back I have covered neumorphic design in one of my thread and now in this thread we will be creating glassmorphic form.

Glassmorphism design is all about one CSS property which is backdrop-filter. Let's start πŸ”½
Step 1: Starting of the basic structure

Just start with writing all necessary tags for form layout. You can any number of input field according to you.
Read 11 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!

:(