From React to Astro: Why I Switched


Introduction
It all began with a simple project I decided to create for my sister, centered around a business idea. I started by selecting the framework and design, and the first command I ran was: npx create-react-app
.
I chose React JS for several compelling reasons:
Component-Based Architecture: This made it easier to manage and navigate the code, especially as the project grew in complexity.
Lightweight Nature: Initially, this allowed the website to load quickly and efficiently, enhancing user experience.
Single Page Application (SPA): This provided a seamless user experience by eliminating the need for full-page reloads.
However, as the project evolved and the number of components increased, the very reason I chose React JS—its lightweight nature—began to fade. This unexpected challenge made me rethink and adapt my approach to maintain the efficiency and performance of the application.
Issues I faced with React JS
As I began working on the project, the framework felt seamless. The component reusability and the single-page application (SPA) functionality worked flawlessly, delivering a smooth development experience. However, as I delved deeper into the project, things started to take a turn. What was once a lightweight and efficient system began to feel cumbersome. The components, which were initially designed to be lightweight, grew in complexity and size, leading to performance bottlenecks. Along the way, I encountered several challenges that tested my problem-solving skills and forced me to rethink my approach.
Routing Issues
As I added more components to the project, routing quickly became a nightmare. Using React Router, I found myself writing tons of boilerplate code just to handle navigation. What was supposed to be a straightforward process turned into a tedious and time-consuming task, making me question whether I had chosen the right approach.
Performance Degradation :
The platform, which initially prided itself on being lightweight, gradually transformed into a heavyweight beast. With every new feature I added, the performance took a hit. The website became slower, and the user experience suffered significantly. What was once a fast and efficient application now felt sluggish, forcing me to rethink my strategies for optimization.
Backend Integration, SSR And Typescript :
As the project expanded, challenges piled up. Backend integration became cumbersome, with data fetching and state management feeling overly complex due to React’s client-side nature. TypeScript, while promising for type safety, added layers of effort and compatibility headaches. And when it came to server-side rendering (SSR), React’s client-first design forced me to rely on frameworks like Next.js, which brought their own trade-offs and complexities. What started as a lightweight solution soon revealed its limitations.
After facing all these issues I found a new platform with all the fixes I needed for my website. The framework I am talking about is Astro.
Astro : The web framework for content-driven websites
After getting into all these blunder, I found a better framework Astro , a framework that promised lightweight performance, better routing, seamless backend integration, and built-in SSR.
Just type npm create astro@latest
The Reasons why Astro blew my mind :
Lightning Fast Performance :
Astro bring lightweight and only using the necessary Javascript, making it fast and optimize delievry of speed
Simplified Routing :
Astro’s file-based routing system made navigation effortless and lightning-fast. Creating new pages was as simple as adding a
.astro
file inside thepages/
directory—no boilerplate code or complex configurations required.Seamless Backend Integration
Astro’s built-in support for server-side rendering (SSR) made backend integration a breeze. By organizing APIs into separate folders/files, fetching and retrieving data became smoother and more efficient.
TypeScript Without the Hassle :
Unlike React, where TypeScript often felt like an additional layer of complexity, Astro treats it as a lightweight add-on. This brought enhanced type safety and security to the project without the usual headaches.
Hybrid Flexibility :
One of Astro’s standout features is its ability to integrate seamlessly with other frameworks like React, Vue, and Svelte. This meant I didn’t have to abandon my React knowledge entirely—I could leverage it alongside Astro’s powerful features.
Some Examples why Astro is better than React JS
Image 1 : Code Snippet
"Astro’s simplicity shines in this
index.astro
file. With minimal code, it imports a layout and a component (HomeContent
), usingclient:load
for client-side hydration. No boilerplate, just clean and efficient development."
Project Structure
"Astro’s organized folder structure keeps components, layouts, and pages neatly separated. This modular approach ensures scalability and easy maintenance as the project grows."
File-Based Routing
"Astro’s file-based routing makes creating pages effortless. Just add a file to the pages
directory—no extra code needed. Dynamic routes like [id].astro
or [slug].astro
handle dynamic content seamlessly, making it easy to build blogs, product pages, or user profiles with clean, readable URLs."
Subscribe to my newsletter
Read articles from Manav Adwani directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
