This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel (or oxc when used in rolldown-vite) for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])A collection of React + TypeScript machine coding interview questions and solutions. This repo contains various UI components commonly asked in frontend interview rounds.
- Pagination - Implement paginated product listing with page size selector
- Autocomplete - Search with caching and debouncing
- Tab Form - Multi-step form with validation across tabs
- Profile - Form component with dynamic field handling
- Interest Selection - Multi-select component
- Settings - Configuration panel
- React 18 - UI library
- TypeScript - Type safety
- Vite - Build tool with HMR
- CSS - Styling
- Node.js (v16+)
- npm or yarn
npm install
npm run devnpm run buildnpm run previewsrc/
├── components/
│ ├── Pagination/
│ ├── Autocomplete/
│ ├── TabForm/
│ │ ├── Profile.tsx
│ │ ├── Interest.tsx
│ │ └── Settings.tsx
│ └── ...
├── App.tsx
└── main.tsx
- State Management - useState, useEffect, useCallback
- Performance - useMemo, useCallback, debouncing, caching
- Type Safety - TypeScript interfaces and generics
- Form Handling - Controlled components, validation
- UI Patterns - Pagination, search, multi-step forms, tabs
For stricter type checking in production, update your ESLint config to enable type-aware rules:
tseslint.configs.strictTypeCheckedOptional: Add React-specific lint rules:
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'- Focus on component reusability
- Handle edge cases (empty states, loading, errors)
- Optimize performance (memoization, caching)
- Write clean, readable code
- Add proper TypeScript types
- Consider accessibility (aria labels, semantic HTML)
Practice hard, code clean! 🚀