TNS
VOXPOP
Where are you using WebAssembly?
Wasm promises to let developers build once and run anywhere. Are you using it yet?
At work, for production apps
0%
At work, but not for production apps
0%
I don’t use WebAssembly but expect to when the technology matures
0%
I have no plans to use WebAssembly
0%
No plans and I get mad whenever I see the buzzword
0%
Frontend Development / JavaScript / Software Development

New Framework Lets Devs Explore React Server Components

A new minimal React framework called Waku lets developers try out React Server Components without worrying about unneeded features.
Jan 11th, 2024 4:00am by
Featued image for: New Framework Lets Devs Explore React Server Components
Photo by Mike van Schoonderwalt via Pexels

There’s now a minimal framework for React Server Components called Waku — Japanese for “frame or framework.” While it’s not recommended for production yet, it is ready for developers who want to explore RSC’s capabilities, said its creator.

Daishi Kato wrote Waku, as well as Zustand (a state management library for React applications) and Jotai (another state management tool, for which he built the library). Waku is being actively developed toward the production level, he said.

“At this point, it’s ready to play with it, which means you can try and learn RSC behaviors, you can implement a new app with RSC features, and you can try to migrate an existing app to Waku,” Kato told The New Stack. “However, we don’t officially recommend it for production yet, as the APIs may still change.”

Why Another JS Framework?

We know, we know — another JavaScript framework. But this React-specific framework serves several, specific purposes.

“We want to learn RSC, but it’s often tied with other features in a framework,” Kato explained. “I would like to separate them and I expect this will help people to learn and understand RSC better.”

Developers also want a minimal framework, he said, adding that React use cases are broad.

“SPA is still one of the major use cases,” he said. “Richer frameworks provide more features that SPA doesn’t require.”

Plus, Kato wanted to add support for RSC to Zustand and Jotai. He didn’t want to wait for other frameworks to create that opportunity for him, so he decided to create his own framework.

While the JavaScript framework Next.js supports RSC, the minimal API is tied to a specific router — a key issue since with RSC, the rendering happens on the server, according to Bytes Newsletter. Waku isn’t tied to a specific router and so allows for more experimentation to come from the rest of the React ecosystem, Bytes explained, adding that Waku is built on top of Vite so there are no Node-dependent APIs.

“RSC still relies on a framework — or at least a bundler — for implementation. However, as frameworks introduce RSC on top of their existing static site generation (SSG) and server-side rendering (SSR) capabilities, learning and experimenting with how to develop applications or libraries solely with RSC features are somewhat complicated,” Kato explained on a site about and developed on Waku.

Waku allows developers to explore the core RSC capabilities and RSC best practices “independent of traditional SSG/SSR strategies, which are optional opt-in functionalities,” he wrote.

But what developers learn about RSC with Waku should be transferable to other frameworks, he told The New Stack.

“The good news is that Waku’s original API is very minimal, so what you learn about RSC is mostly common between Waku and other frameworks,” he said.

What Waku Includes

To use Waku, developers do need to know React well and have a basic understanding of RSC, both of which can be garnered from React and Next.js documentation, he said.

Bytes noted that Waku provides a server API, a client API, and routing that comes with an optional client-side and server-side router.

Kato wasn’t interested in building a bundler, so he did what other JavaScript frameworks are increasingly doing — he turned to Vite, a local development server.

“Vite is a bundler and it’s pretty extensible,” he said. “Vite also provides a dev server, which is also a fundamental feature for better DX.”

While Waku allows developers to try RSC outside Vercel, which maintains Next.js. Vercel sponsored Waku via GitHub and it’s possible to deploy to Vercel’s platform.

“Vercel supports the deployment of any frontend framework,” Kato wrote on Waku’s site. “We use their Build Output API to produce output from Waku, which can be deployed to Vercel.”

Waku is open sourced under the MIT license. Documentation is still in the works, but there’s a discussion on GitHub and a Discord link on the Waku site menu where developers can learn more.

Group Created with Sketch.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.