React Development
React Project Setup
React Project Setup
Section titled “React Project Setup”Learn to create a new React project using popular tools.
Vite (Recommended)
Section titled “Vite (Recommended)”# Create projectnpm create vite@latest my-react-app -- --template react
# With TypeScriptnpm create vite@latest my-react-app -- --template react-ts
# Install dependenciescd my-react-appnpm install
# Start dev servernpm run devCreate React App
Section titled “Create React App”# Create projectnpx create-react-app my-app
# With TypeScriptnpx create-react-app my-app --template typescript
# Start dev servercd my-appnpm startProject Structure
Section titled “Project Structure”my-react-app/├── public/│ └── index.html├── src/│ ├── App.jsx│ ├── App.css│ ├── main.jsx│ └── components/├── package.json└── vite.config.jsEssential Files
Section titled “Essential Files”main.jsx
Section titled “main.jsx”import React from 'react';import ReactDOM from 'react-dom/client';import App from './App';import './index.css';
ReactDOM.createRoot(document.getElementById('root')).render( <React.StrictMode> <App /> </React.StrictMode>);App.jsx
Section titled “App.jsx”function App() { return ( <div className="App"> <h1>Hello React!</h1> </div> );}
export default App;VS Code Extensions
Section titled “VS Code Extensions”- ES7+ React/Redux/React-Native snippets
- Prettier - Code formatter
- ESLint
- Auto Rename Tag