
Remix v2 Has a Free API — Heres How to Build Full-Stack Apps With It
Remix v2 gives you a full-stack framework with built-in data loading, mutations, and server-side rendering. Why Remix v2? Nested routes : Each route is a boundary with its own data and error handling Server-first : Data loads on the server, HTML streams to client Progressive enhancement : Forms work without JavaScript Web Fetch API : Standard Request/Response everywhere Vite-powered : Lightning-fast HMR and builds Quick Setup npx create-remix@latest my-app cd my-app && npm run dev Route-Based Data Loading Every route exports a loader that runs on the server: import { json } from ' @remix-run/node ' ; import { useLoaderData } from ' @remix-run/react ' ; export async function loader () { const posts = await db . post . findMany ({ orderBy : { createdAt : ' desc ' }, take : 20 }); return json ({ posts }); } export default function Posts () { const { posts } = useLoaderData < typeof loader > (); return < ul > { posts . map ( p => < li key = { p . id } > { p . title } < /li> ) }</u l > ; }
Continue reading on Dev.to React
Opens in a new tab
