DEV Community

reactwindd
reactwindd

Posted on

3 1

Perfect React App

Explanation For Each Dependencies

React Router ➣ Routing (example.com/something instead of example.com/something.html)

TailwindCSS ➣ Quicker Styling

Framer Motion ➣ CSS Animation

Creating A Vite.js + React.js App

// Command-Line

npm create vite@latest demo --template react
or
npm create vite@latest demo -- --template react

cd demo
npm install
Enter fullscreen mode Exit fullscreen mode

Installing Dependencies

// Command Line

npm install react-router-dom@6
npm install framer-motion
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
Enter fullscreen mode Exit fullscreen mode

Configure Frameworks

// tailwind.config.js

module.exports = {
  content: [
    "./index.html",
    "./src/**/*.{js,jsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}

// index.css

@tailwind base;
@tailwind components;
@tailwind utilities;
Enter fullscreen mode Exit fullscreen mode

Use React Router

// App.jsx

import { BroswerRouter, Routes, Route, Link } from 'react-router-dom';

function App() {
    return (
        <BroswerRouter>
            <Routes>
                <Route path='/' element={<Home />} />
                <Route path='/page2' element={<Page2 />} />
            </Routes>
        </BroswerRouter>
    )
}

function App() {
    return (
        <>
            <h1>Home</h1>
            <Link to='/'>Home</Link>
            <Link to='/page2'>Page2</Link>
        </>
    )
}

function Page2() {
    return (
        <>
            <h1>Page2</h1>
            <Link to='/'>Home</Link>
            <Link to='/page2'>Page2</Link>
        </>
    )
}

export default App;
Enter fullscreen mode Exit fullscreen mode

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay