React ን Production-Ready አድርግ! SEO፣ Speed፣ API — ሁሉም አብሮ! ⬛🚀
Next.js takes React to the next level — server-side rendering, static generation, built-in API routes, and much more!
Next.js = React ን top ላይ የሰራ Framework! Vercel ሰራው። Plain React ን ብቻ ሲጠቀሙ SEO ችግር ይኖራሃል — Next.js ያስተካክላሃል! ፈጣን፣ SEO-friendly፣ API routes built-in!
Next.js is a React framework by Vercel. It adds SSR, SSG, file-based routing, and API routes — making React apps production-ready!
Next.js ዋናው Magic! Folder/File ስም = URL ይሆናል! React Router code አያስፈልግም — pages/about.js = yoursite.com/about ራሱ ይሆናል!
Magic! File name = URL automatically. No router setup needed — just create files in the pages folder!
import { useRouter } from 'next/router'; export default function BlogPost() { const router = useRouter(); const { id } = router.query; // URL ውስጥ ያለ [id] return ( <div> <h1>Blog Post #{id}</h1> {/* /blog/5 → id = "5" */} {/* /blog/hello → id = "hello" */} </div> ); }
Next.js 4 rendering methods አለው — ሁኔታ ሁኔታ የተለያየ ይጠቀማሉ! ምን ዓይነት ውሂብ ነው? ምን ያህል ፈጣን ያስፈልጋል? ያ ይወስናሃል!
Next.js gives you 4 ways to render pages — choose based on how often data changes and how fast you need it!
// ── SSR — ሁሉም request ላይ server ይሰራዋል ────── export async function getServerSideProps(context) { const res = await fetch(`https://api.ethiocode.com/posts`); const data = await res.json(); return { props: { posts: data } }; // ← ሁሌ fresh data ✅ | ትንሽ 느린 ⚠️ } // ── SSG — Build time አንድ ጊዜ ብቻ ────────────── export async function getStaticProps() { const res = await fetch('https://api.ethiocode.com/courses'); const data = await res.json(); return { props: { courses: data }, revalidate: 3600, // ISR — 1 ሰዓት ይጠብቅ ዘምን }; } // ── Page Component ───────────────────────────── export default function Home({ posts, courses }) { return ( <div> {posts.map(p => ( <PostCard key={p.id} post={p} /> ))} </div> ); }
Next.js ውስጥ Backend! pages/api/ folder ውስጥ file ስትፈጥር ራሱ API endpoint ይሆናል! Express ለብቻ አያስፈልግም!
Create files in pages/api/ — each file becomes an API endpoint automatically! No separate Express server needed for simple APIs!
// pages/api/users.js → yoursite.com/api/users export default function handler(req, res) { if (req.method === 'GET') { // GET /api/users — ሁሉም users ስጥ res.status(200).json({ users: [ { id: 1, name: 'Abel', role: 'admin' }, { id: 2, name: 'Sara', role: 'user' }, ] }); } else if (req.method === 'POST') { // POST /api/users — አዲስ user ፍጠር const { name, email } = req.body; // DB save logic here... res.status(201).json({ message: 'Created!', name }); } else { res.status(405).json({ error: 'Method not allowed' }); } } // React ውስጥ ጠቅ ለማድረግ: // fetch('/api/users') — Same domain! CORS ችግር የለም!
ሙሉ Next.js App ምሳሌ! Home, Blog, API — File-based routing ስሜት! Page ሲቀያየር URL ይቀያየራሃል!
A real Next.js app experience — navigate between pages, test the API route, see how routing works!
HTML ጀምሮ Full Stack ደረስ! ሁሉም ትምህርቶች ነፃ! React + Next.js ተጠቅሞ ሰራ!
getStaticProps() ተጠቅሞ build time ላይ ተሰራ — Ultra fast! 🚀
React ን ታውቃለህ? Next.js ቀላሉ ነው! npx create-next-app@latest my-app — ተጀምሯል!
If you know React, you already know 80% of Next.js — it just adds superpowers on top!
pages/about.js = /about | pages/blog/[id].js = /blog/:id — React Router code ያስፈልጋቸዋል!
File system is your router. Create a file, get a route — that simple!
ዜና site → SSG (fast) | Social feed → SSR (fresh) | Dashboard → CSR (auth) | Blog → ISR (both!)
Choose rendering method based on how often data changes. ISR = best of both worlds!
pages/api/users.js = /api/users endpoint! MongoDB + Mongoose ጨምር → ሙሉ Full Stack!
No separate Express needed for simple APIs. One Next.js project = frontend + backend!
GitHub push → Vercel auto-deploy! vercel.com → GitHub connect → Done! ነፃ!
Vercel made Next.js — deploying there is effortless. Push to GitHub, Vercel handles the rest!
Incredible! React Framework ትምህርት ጨረስን! 🎉
ቀጣይ ምርጫ: Docker 🐳 | GraphQL 🔮 | AWS ☁️ | Prisma 🗄️
🌐 ethiocodesoftselect.netlify.app
ቻናሉን ክፈቱ → Join 🚀