Skip to content

Commit 846f74a

Browse files
authored
Update React.md to use Vite instead of CRA
CRA is slowly being deprecated and one of the easiest ways to get started is using Vite, hence I propose to include Vite as a starting point.
1 parent 31cedd7 commit 846f74a

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

React.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,25 @@ React is a JavaScript library developed by Facebook for building user interfaces
2323

2424
## Setting Up a React Project with TypeScript
2525

26-
To get started with React and TypeScript, you need to set up a new project. You can use tools like Create React App (CRA) or manually configure the project.
26+
To get started with React and TypeScript, you need to set up a new project. You can use tools like Vite, [Next.js, Remix, Gatsby](https://react.dev/learn/start-a-new-react-project) or manually configure the project.
2727

28-
Here's an example of setting up a new React project with TypeScript using Create React App:
28+
Here's an example of setting up a new React project with TypeScript using Vite (more info in the [Official docs](https://vitejs.dev/guide/)):
2929

3030
```bash
31-
npx create-react-app my-app --template typescript
31+
# npm 6.x
32+
npm create vite@latest my-app --template react-ts
33+
34+
# npm 7+, extra double-dash is needed:
35+
npm create vite@latest my-app -- --template react-ts
36+
3237
cd my-app
33-
npm start
38+
npm install
39+
npm run dev
3440
```
35-
3641
This command creates a new React project named `my-app` with TypeScript template and starts the development server.
3742

43+
**Note:** You can also use Create React App (CRA), but it's slowly being [deprecated](https://hackernoon.com/create-react-app-is-dead-here-are-some-alternatives) due to a lack of recent updates.
44+
3845
## Components in React with TypeScript
3946

4047
Components are the building blocks of a React application. In TypeScript, you can define components as functional components or class components. Functional components are simpler and recommended for most use cases.

0 commit comments

Comments
 (0)