Migrating Our Dashboard from React to Next.js
Migrating Our Dashboard from React to Next.js
Our signals dashboard started as a Create React App project, but as we grew, we needed more features and better performance. Here's how we migrated to Next.js and what we learned along the way.
Why Next.js?
We chose Next.js for several compelling reasons:
- Better Performance: Server-side rendering and automatic code splitting
- Enhanced SEO: Built-in head management and server rendering
- Developer Experience: Improved routing and API routes
- Built-in Optimizations: Image optimization and font loading
Key Benefits We've Seen
-
Faster Page Loads
- Initial page loads reduced by 60%
- Automatic image optimization
- Better code splitting
-
Improved Development
- Hot reloading is much faster
- Better error handling
- TypeScript integration
"The migration to Next.js has significantly improved both our user experience and developer productivity."
Migration Process
1. Project Structure
// Old structure (CRA)
src/
components/
pages/
App.tsx
index.tsx
// New structure (Next.js)
src/
app/
layout.tsx
page.tsx
components/
2. Routing Changes
Before:
<Router>
<Route path="/" element={<Home />} />
<Route path="/signals" element={<Signals />} />
</Router>
After:
// app/page.tsx
export default function Home() {
return <HomePage />
}
// app/signals/page.tsx
export default function Signals() {
return <SignalsPage />
}
3. Data Fetching
We moved from client-side fetching to server components where possible:
// Before (React)
useEffect(() => {
fetch('/api/signals').then(...)
}, [])
// After (Next.js)
async function SignalsPage() {
const data = await fetchSignals()
return <SignalsList signals={data} />
}
Results
-
Performance
- 60% faster page loads
- 45% improvement in Core Web Vitals
- Better SEO rankings
-
Developer Experience
- Faster development cycles
- Better debugging tools
- Simplified deployment
Next Steps
- Implementing more server components
- Exploring Next.js 14 features
- Adding more performance optimizations
Feel free to reach out if you have questions about our migration process!