DEV Community

Cover image for Building My first React Web Application – A Developer's Journey πŸš€
Manish Yadav
Manish Yadav

Posted on

Building My first React Web Application – A Developer's Journey πŸš€

Step 1: Choosing the Right Tech Stack

Before starting, I decided to use React for its component-based architecture and efficient rendering. Along with React, I used:
βœ… Vite for a fast development setup
βœ… Tailwind CSS for styling
βœ… other libraries/frameworks like Redux,

Step 2: Setting Up the Project

I initialized my project using Vite:

sh

npm create vite@latest paste-app
cd paste-app
npm install
npm run dev
Enter fullscreen mode Exit fullscreen mode

This gave me a blazing-fast dev server with hot reloading.

Step 3: Creating the Core Components

I structured my app into reusable components like:

  • Navbar.jsx – Navigation bar
  • Home.jsx – Main page content
  • Past.x.jsx – Bottom section with links
  • Viewpaste.jsx – for view paste notes and documents

Step 4: Managing State with Hooks

To handle app state, I used useState and useEffect:

jsx
const [data, setData] = useState([]);

useEffect(() => {
  fetchData();
}, []);

const fetchData = async () => {
  const response = await fetch("https://api.example.com/data");
  const result = await response.json();
  setData(result);
};
Enter fullscreen mode Exit fullscreen mode

This helped me fetch and display dynamic content.

Step 5: Adding Routing with React Router

I set up navigation using react-router-dom:

sh

npm install react-router-dom
Enter fullscreen mode Exit fullscreen mode

Then, I created routes in App.jsx:

jsx

import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import Home from "./Home";
import Navbar from "./Navbar";

function App() {
  return (
    <Router>
      <Routes>
        <Route path="/" element={<Home />} />
        <Route path="/Navbar" element={<Navbar />} />
      </Routes>
    </Router>
  );
}

export default App;
Enter fullscreen mode Exit fullscreen mode

This made my app a multi-page experience without reloading.

Step 6: Styling the UI

I used Tailwind CSS for quick styling:

terminal


npm install tailwindcss @tailwindcss/vite
Enter fullscreen mode Exit fullscreen mode

vite.config.ts




import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
  plugins: [
    tailwindcss(),
  ],
})
Enter fullscreen mode Exit fullscreen mode

Import tailwind in CSS file

@import "tailwindcss";

Enter fullscreen mode Exit fullscreen mode

Then,

npm run dev
Enter fullscreen mode Exit fullscreen mode

Then, added styles like this:

jsx

<div className='flex flex-row gap-2 place-content-center  '>
        <input type="text"
          className='p-2 pl-2  rounded-2xl  mt-2 border w-[30%]'
          placeholder='enter title here'
          value={title}
          onChange={(e) => settitle(e.target.value)} />
        <button
          onClick={createpaste}
          className='p-2  rounded-2xl  mt-2 ' >
          {
            pasteId ? "update my paste" : "create my paste"
          }
        </button >
      </div>
Enter fullscreen mode Exit fullscreen mode

This kept my styling clean and maintainable.

Step 7: Deploying the App

Once I was happy with my app, I deployed it on Vercel:

sh

npm run build
vercel deploy
Enter fullscreen mode Exit fullscreen mode

Now, my app is live and accessible online! πŸŽ‰

Final Thoughts & Lessons Learned
Building this React app taught me:
βœ… How to structure a scalable project
βœ… The power of reusable components
βœ… How to manage state effectively
βœ… The importance of performance optimization

πŸ”Ή Next Steps: Adding better tailwindcss ,authentication, dark mode, and improving responsiveness!

Heroku

Deliver your unique apps, your own way.

Heroku tackles the toil β€” patching and upgrading, 24/7 ops and security, build systems, failovers, and more. Stay focused on building great data-driven applications.

Learn More

Top comments (0)

Image of Stellar post

How a Hackathon Win Led to My Startup Getting Funded

In this episode, you'll see:

  • The hackathon wins that sparked the journey.
  • The moment JosΓ© and Joseph decided to go all-in.
  • Building a working prototype on Stellar.
  • Using the PassKeys feature of Soroban.
  • Getting funded via the Stellar Community Fund.

Watch the video πŸŽ₯

πŸ‘‹ Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s dayβ€”drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay