Let's get started with setting up a new React project that uses TypeScript, all powered by Vite.

  1. Open your terminal and run the following command:
npm create vite@latest
  1. Name your project: The installer will prompt you for a project name. I'm calling mine react-with-ts, but feel free to choose any name you like!

image.png

  1. Choose your framework and variant: You'll then be asked to select a framework and a variant. Make sure to choose React for the framework and TypeScript for the variant.

image.png

      now follow next steps to install all other dependencies

image.png

  1. Clean up unnecessary files: Once the project is created, it's a good idea to tidy things up. You can safely remove files and folders that we won't be using for a fresh start, such as assets, app.css, index.css, and the entire public folder

image.png

  1. Prepare App.tsx: Navigate to the App.tsx file. Delete all the existing code inside it, and then use the rafce

image.png

  1. Verify your setup: Finally, let's make sure everything is running smoothly. In your terminal, run:

image.png

This should start your development server, and you can open your browser to confirm the app is working!


Understanding Component Props in Action

  1. Create a components folder: First, within your src directory, create a new folder called components. This is where we'll house our reusable UI pieces.
  2. Create your component file: Inside the newly created components folder, let's create a file named Chai-Order.tsx. This file will contain our ChaiOrder component.