React Basics

What is React?

It is a library for building user interfaces

Reference : https://www.udemy.com/course/react-the-complete-guide-incl-redux/learn/lecture/38345144#overview 

Demo

  

Exercise

  • before app here.
  • solution here.

 

Repo

How to create a new react app ?

 can create a new project locally as well

 

then

 

final

 

NPM vs NPX

 

Why do we need starter code ?

 

Create-React-App or Vite for a new project ?

https://www.reddit.com/r/reactjs/comments/yuxa16/createreactapp_or_vite_for_new_project/

Vite and Create React App (CRA) are both tools for creating React projects, but they differ in their approach and performance. Vite is a newer, faster build tool that uses native ES modules and pre-bundling, resulting in faster development and build times. CRA, on the other hand, is a more established tool that uses Webpack and provides a zero-configuration setup, making it easier for beginners. 
 

Key Differences:

  • Build Tool:- CRA uses Webpack, while Vite uses native ES modules and pre-bundling. 
    • webpack is a module builder  
  • Configuration:- CRA is known for its zero-configuration setup, while Vite offers more flexibility and customization through a vite.config.js file. 
  • Development Experience:- Vite's development server is significantly faster due to its use of ES modules and pre-bundling, leading to near-instantaneous hot module replacement (HMR). 
  • Performance:- Vite generally results in smaller bundle sizes and faster build times compared to CRA. 
  • Ecosystem:-  CRA has a larger, established ecosystem with extensive documentation and community support, while Vite's ecosystem is growing rapidly. 
  • Framework Support:- CRA is primarily for React, while Vite supports multiple frameworks and libraries. 

When to use which ?

  • Vite :- For projects where speed and flexibility are priorities, and where you're comfortable with a slightly more involved setup. Vite is also a good choice for larger projects where faster build times and development experience are crucial. 
  • CRA :- For projects where ease of use and a no-configuration approach are desired, especially for beginners or projects where you don't anticipate needing extensive customizations. CRA also provides a solid foundation with sensible defaults and best practices. 

In summary: Vite offers a faster and more flexible development experience, while CRA provides a simpler and more established approach for building React projects. The best choice depends on your project's specific needs and priorities.
 

 

 

Comments

Popular posts from this blog

Agentic AI Course : Week 1

LLM Engineering course : Day 1

LLM Engineering : Week 2