react-vite

React Vite Development

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "react-vite" with this command: npx skills add alicoder001/agent-skills/alicoder001-agent-skills-react-vite

React Vite Development

Fast React SPA development with Vite.

Instructions

  1. Project Structure

src/ ├── main.tsx # Entry point ├── App.tsx # Root component ├── components/ │ ├── ui/ # Reusable UI │ └── features/ # Feature components ├── hooks/ # Custom hooks ├── lib/ # Utilities ├── pages/ # Page components ├── store/ # State management ├── types/ # TypeScript types └── styles/ # Global CSS

  1. Vite Configuration

// vite.config.ts import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import path from 'path';

export default defineConfig({ plugins: [react()], resolve: { alias: { '@': path.resolve(__dirname, './src'), }, }, server: { port: 3000, proxy: { '/api': 'http://localhost:8000', }, }, build: { rollupOptions: { output: { manualChunks: { vendor: ['react', 'react-dom'], }, }, }, }, });

  1. Environment Variables

.env

VITE_API_URL=http://api.example.com VITE_APP_NAME=My App

Usage

const apiUrl = import.meta.env.VITE_API_URL;

  1. Path Aliases

// tsconfig.json { "compilerOptions": { "baseUrl": ".", "paths": { "@/": ["src/"] } } }

  1. React Router Setup

// src/main.tsx import { BrowserRouter } from 'react-router-dom';

ReactDOM.createRoot(document.getElementById('root')!).render( <BrowserRouter> <App /> </BrowserRouter> );

// src/App.tsx import { Routes, Route } from 'react-router-dom';

function App() { return ( <Routes> <Route path="/" element={<Home />} /> <Route path="/about" element={<About />} /> <Route path="*" element={<NotFound />} /> </Routes> ); }

  1. Lazy Loading Routes

import { lazy, Suspense } from 'react';

const Dashboard = lazy(() => import('./pages/Dashboard'));

function App() { return ( <Suspense fallback={<Loading />}> <Routes> <Route path="/dashboard" element={<Dashboard />} /> </Routes> </Suspense> ); }

  1. Development Scripts

{ "scripts": { "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", "lint": "eslint src --ext ts,tsx" } }

References

  • Vite Documentation

  • React Router

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

solid

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

reasoning

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

collaboration

No summary provided by upstream source.

Repository SourceNeeds Review