惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
Blog — PlanetScale
Blog — PlanetScale
Recent Announcements
Recent Announcements
Last Week in AI
Last Week in AI
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Vercel News
Vercel News
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
罗磊的独立博客
H
Help Net Security
月光博客
月光博客
Martin Fowler
Martin Fowler
博客园 - 【当耐特】
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
GbyAI
GbyAI
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Netlify Developers

AI model comparison using Netlify's AI Gateway | Netlify Developers Build an AI agent to automatically process and summarize form submissions | Netlify Developers Build an AI agent to automatically generate relevant images for blog posts | Netlify Developers Prerendering SPA content pages to enable AI agent access | Netlify Developers Identify image optimization opportunities with Netlify Observability | Netlify Developers Fix top 404 page not found errors with Netlify Observability | Netlify Developers Introducing AI Gateway: built-in AI model access on Netlify | Netlify Developers Introducing Observability: your project insights on Netlify | Netlify Developers From first publish to first update with AI agents | Netlify Developers How to use Agent Runners on Netlify | Netlify Developers Add forms to your project with AI + Netlify | Netlify Developers Track Real User Metrics | Netlify Developers Lighthouse performance scores on Netlify | Netlify Developers Review your AI project before you ship | Netlify Developers Using environment variables in AI Projects on Netlify | Netlify Developers Build prototypes and MVPs fast with AI + Netlify | Netlify Developers Pause auto-publishing on Netlify | Netlify Developers Run serverless functions, storage, and more natively in Nuxt dev | Netlify Developers Netlify Office Hours: The AX Arcade challenge | Netlify Developers Netlify Office Hours: Prompting with style | Netlify Developers Netlify Office Hours: RAG Apps with OpenAI + Netlify DB | Netlify Developers How to build a RAG application with Neon, Netlify & OpenAI | Netlify Developers Netlify Office Hours: Netlify DB (powered by Neon) | Netlify Developers Netlify Office Hours: Netlify MCP Server | Netlify Developers Netlify Office Hours: Netlify Vite Plugin | Netlify Developers Building MCPs with Netlify | Netlify Developers Deploying sites from your AI tool | Netlify Developers Adding your domain using Netlify API | Netlify Developers Build a context driven chat bot with Netlify Blob and OpenAI | Netlify Developers Simplify deployments with Netlify’s branch-matching environment variables | Netlify Developers
Using Waku on Netlify for React Server Components | Netli...
2024-02-21 · via Netlify Developers

Waku is the minimal React framework. It’s designed for startups and agencies seeking a lightweight alternative for small to medium-sized React projects. The Waku team is currently working towards building Waku into a production-ready React framework, but it’s already suitable for experimenting with React Server Components and building applications for non-production purposes.

Waku. The minimal react framework

#TL;DR

Support for Netlify was recently added to Waku. Now you can develop a React app with React Server Component (RSC) capabilities and deploy it on Netlify seamlessly. This post will show you how you can get started quickly and easily.

#What’s a React Server Components framework?

Waku is an RSC framework. That means you can use it to create server components, which are executed exclusively on the server (or in a serverless runtime environment). You can make them async to fetch remote data on the server, access the file system, or even use heavy dependencies, since they have zero impact on the client bundle size.

Then only when necessary, you may also create client components, which are hydrated in the browser. You can then use all traditional React features such as state, effects, and event handlers. The boundaries between server and client are marked with the ‘use client’ directive.

Keep in mind that SSR is a distinct concept from RSC. Waku provides static pre-rendering (sometimes called Static Site Generation or SSG) and server-side rendering (SSR) options for each layout and page including both their server and client components.

Being a minimal framework with a tight focus, Waku can be helpful in learning the RSC concept. Exploring examples is a great way to understand the distinction between server components and client components. So let’s get an example site deployed to Netlify quickly so you can use it to explore deeper.

#Prerequisites

#Creating and deploying a Waku project

You can create and deploy your app on Netlify using this starter project:

https://github.com/dai-shi/waku-netlify-starter

Visit the project repo or click the button below to clone the project and deploy it directly to Netlify.

Deploy to Netlify

#Local development of your Waku project

You can clone the starter project, (or your own copy of it created for you by clicking the Deploy to Netlify button above) to your local development machine to start exploring and making changes.

# Clone the project repo (or use the URL of your copy of this repo)

git clone https://github.com/dai-shi/waku-netlify-starter

# Go to the project and install the dependencies

cd waku-netlify-starter

npm install

# Run the project locally in development mode

npm run dev

Did you know

You’ll automatically get the push-to-deploy functionality provided by Netlify’s continuous integration pipeline for this project if you use the Deploy to Netlify button above to create a site linked to your own copy of the starter template.

Locally clone the repo created for you into your GitHub account to join the docs and start deploying directly from your commits.

#Continuing to explore Waku

Now that you’ve deployed a Waku site to Netlify, you can use it to explore more of what Waku has to offer and learn more about React Server Components. There are plenty of features and capabilities on the official Waku site to explore, such as:

#Rendering on the server at request time or at build time

Waku provides the capability to render some elements on the server at build time (SSG) and other elements on the server at request time (SSR). And as always you can also render components exclusively on the client side (CSR). This flexibility is helpful for optimizing your sites for the best user experience.

See the Rendering section for more details.

#Programmatically generate and populate pages with createPages

Waku’s createPages function gives you the ability to generate websites with blend of rendering techniques. This lets you specify purely static elements of a page, such as the site’s header and footer, and also the sections of the page that will be enriched with dynamic content. This makes for a powerful and performant combination.

See this post about createPages for more details

The integrated Link component generates the markup and progressive enhancement necessary to prefetch links to internal pages so navigation throughout a Waku site is instantaneous.

See the Navigation section for more details.

#Data fetching

All the usual patterns you’d expect for fetching and parsing data on the server are available at build time and request time in server components. Client-side data fetching libraries are also supported should you need to perform some data fetching in the client as well.

See the Data fetching section for more details.

#More resources