Skip to content

Commit db789c0

Browse files
authored
docs: update (wakujs#726)
1 parent 4298368 commit db789c0

File tree

2 files changed

+33
-32
lines changed

2 files changed

+33
-32
lines changed

README.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ visit [waku.gg](https://waku.gg) or `npm create waku@latest`
1515

1616
**Waku** _(wah-ku)_ or **わく** means “framework” in Japanese. As the minimal React framework, it’s designed to accelerate the work of developers at startups and agencies building small to medium-sized React projects. These include marketing websites, light ecommerce, and web applications.
1717

18-
We recommend other frameworks for heavy ecommerce or enterprise applications. Waku is a lightweight alternative bringing a fun developer experience to the modern React server components era. Yes, let’s make React development fun again!
18+
We recommend other frameworks for heavy ecommerce or enterprise applications. Waku is a lightweight alternative bringing a fun developer experience to the server components era. Yes, let’s make React development fun again!
1919

2020
> Waku is in rapid development and some features are currently missing. Please try it on non-production projects and report any issues you may encounter. Expect that there will be some breaking changes on the road towards a stable v1 release. Contributors are welcome.
2121
@@ -31,7 +31,7 @@ npm create waku@latest
3131

3232
## Rendering
3333

34-
While there’s a little bit of a learning curve to modern React rendering, it introduces powerful new patterns of full-stack composability that are only possible with the advent of [server components](https://github.com/reactjs/rfcs/blob/main/text/0188-server-components.md).
34+
While there’s a bit of a learning curve to modern React rendering, it introduces powerful new patterns of full-stack composability that are only possible with the advent of [server components](https://github.com/reactjs/rfcs/blob/main/text/0188-server-components.md).
3535

3636
So please don’t be intimidated by the `'use client'` directive! Once you get the hang of it, you’ll appreciate how awesome it is to flexibly move server-client boundaries with a single line of code as your full-stack React codebase evolves over time. It’s way simpler than maintaining separate codebases for your backend and frontend.
3737

@@ -125,7 +125,7 @@ export const Providers = ({ children }) => {
125125

126126
#### Server-side rendering
127127

128-
Waku provides static prerendering (SSG) and server-side rendering (SSR) options for both layouts and pages including all of their server _and_ client components. SSR is a distinct concept from RSC.
128+
Waku provides static prerendering (SSG) and server-side rendering (SSR) options for both layouts and pages including all of their server _and_ client components. Note that SSR is a distinct concept from RSC.
129129

130130
#### tl;dr:
131131

@@ -135,17 +135,17 @@ It begins with a server component at the top of the tree. Then at points down th
135135

136136
Server components can be rendered below this boundary, but only via composition (e.g., `children` props). Together they form [a new “React server” layer](https://github.com/reactwg/server-components/discussions/4) that runs _before_ the traditional “React client” layer with which you’re already familiar.
137137

138-
Client components are server-side rendered as SSR is separate from RSC. See the [linked diagrams](https://github.com/reactwg/server-components/discussions/4) for a helpful visual.
138+
Client components are still server-side rendered as SSR is separate from RSC. Please see the [linked diagrams](https://github.com/reactwg/server-components/discussions/4) for a helpful visual.
139139

140140
#### Further reading
141141

142-
To learn more about the modern React architecture, we recommend [Making Sense of React Server Components](https://www.joshwcomeau.com/react/server-components/) and [The Two Reacts: Part 1](https://overreacted.io/the-two-reacts/).
142+
To learn more about the modern React architecture, we recommend [Making Sense of React Server Components](https://www.joshwcomeau.com/react/server-components/) and [The Two Reacts](https://overreacted.io/the-two-reacts/).
143143

144144
## Routing
145145

146-
Waku provides minimal file-based “pages router” experience built for the modern React server components era.
146+
Waku provides a minimal file-based “pages router” experience built for the server components era.
147147

148-
Its underlying [low-level API](https://github.com/dai-shi/waku/blob/main/docs/create-pages.mdx) is also available for those that prefer programmatic routing. This documentation covers file-based routing since many React developers prefer it, but feel free to try both and see which you prefer.
148+
Its underlying [low-level API](https://github.com/dai-shi/waku/blob/main/docs/create-pages.mdx) is also available for those that prefer programmatic routing. This documentation covers file-based routing since many React developers prefer it, but please feel free to try both and see which you like more!
149149

150150
### Overview
151151

@@ -255,7 +255,7 @@ export const getConfig = async () => {
255255

256256
Segment routes (e.g., `[slug].tsx` or `[slug]/index.tsx`) are marked with brackets.
257257

258-
The rendered React component automatically receives a prop named by the segment (e.g, `slug`) with the value of the rendered segment (e.g., `'introducing-waku'`).
258+
The rendered React component automatically receives a prop named by the segment (e.g., `slug`) with the value of the rendered segment (e.g., `'introducing-waku'`).
259259

260260
If statically prerendering a segment route at build time, a `staticPaths` array must also be provided.
261261

@@ -547,7 +547,7 @@ export const Component = () => {
547547

548548
## Metadata
549549

550-
Waku automatically hoists any title, meta, and link tags to the document head. So adding meta tags is as simple as adding it to any of your layout or page components.
550+
Waku automatically hoists any title, meta, and link tags to the document head. That means adding meta tags is as simple as adding them to any of your layout or page components.
551551

552552
```tsx
553553
// ./src/pages/_layout.tsx
@@ -691,7 +691,8 @@ Files placed in a special `./private` folder of the Waku project root directory
691691
```tsx
692692
export default async function HomePage() {
693693
const file = readFileSync('./private/README.md', 'utf8');
694-
/* ... */
694+
695+
return <>{/* ...*/}</>;
695696
}
696697

697698
export const getConfig = async () => {
@@ -705,7 +706,7 @@ export const getConfig = async () => {
705706

706707
### Server
707708

708-
All of the wonderful patterns of React server components are supported. For example, you can compile MDX files or perform code syntax highlighting on the server with zero impact on the client bundle size.
709+
All of the wonderful patterns enabled by React server components are supported. For example, you can compile MDX files or perform code syntax highlighting on the server with zero impact on the client bundle size.
709710

710711
```tsx
711712
// ./src/pages/blog/[slug].tsx
@@ -736,21 +737,21 @@ export const getConfig = async () => {
736737

737738
### Client
738739

739-
Data should be fetched on the server when possible for the best user experience, but all data fetching libraries such as React Query should be compatible with Waku.
740+
Data should be fetched on the server when possible for the best user experience, but all data fetching libraries such as React Query are compatible with Waku.
740741

741742
## State management
742743

743-
We recommend [Jotai](https://jotai.org) for global React state management based on the atomic model’s performance and scalability, but Waku should be compatible with all React state management libraries such as Zustand and Valtio.
744+
We recommend [Jotai](https://jotai.org) for global React state management based on the atomic model’s performance and scalability, but Waku is compatible with all React state management libraries such as Zustand and Valtio.
744745

745-
We’re exploring a deeper integration of atomic state management into Waku to achieve the performance and developer experience of signals while preserving React’s declarative programming model.
746+
> We’re exploring a deeper integration of atomic state management into Waku to achieve the performance and developer experience of signals while preserving React’s declarative programming model.
746747
747748
## Environment variables
748749

749750
It’s important to distinguish environment variables that must be kept secret from those that can be made public.
750751

751752
#### Private
752753

753-
By default all environment variables are considered private and accessible only in server components, which can be rendered exclusively in a secure environment. You must still take care not to inadvertently pass the variable as props to any client components.
754+
By default all environment variables are considered private and are accessible only in server components, which can be rendered exclusively in a secure environment. You must still take care not to inadvertently pass the variable as props to any client components.
754755

755756
#### Public
756757

docs/create-pages.mdx

+17-17
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ For example, you can statically prerender a global header and footer in the root
1616
// ./src/entries.tsx
1717
import { createPages } from 'waku';
1818

19-
import { RootLayout } from './templates/root-layout.js';
20-
import { HomePage } from './templates/home-page.js';
19+
import { RootLayout } from './templates/root-layout';
20+
import { HomePage } from './templates/home-page';
2121

2222
export default createPages(async ({ createPage, createLayout }) => {
2323
// Create root layout
@@ -46,8 +46,8 @@ Pages can be rendered as a single route (e.g., `/about`).
4646
// ./src/entries.tsx
4747
import { createPages } from 'waku';
4848

49-
import { AboutPage } from './templates/about-page.js';
50-
import { BlogIndexPage } from './templates/blog-index-page.js';
49+
import { AboutPage } from './templates/about-page';
50+
import { BlogIndexPage } from './templates/blog-index-page';
5151

5252
export default createPages(async ({ createPage }) => {
5353
// Create about page
@@ -74,8 +74,8 @@ Pages can also render a segment route (e.g., `/blog/[slug]`). The rendered React
7474
// ./src/entries.tsx
7575
import { createPages } from 'waku';
7676

77-
import { BlogArticlePage } from './templates/blog-article-page.js';
78-
import { ProductCategoryPage } from './templates/product-category-page.js';
77+
import { BlogArticlePage } from './templates/blog-article-page';
78+
import { ProductCategoryPage } from './templates/product-category-page';
7979

8080
export default createPages(async ({ createPage }) => {
8181
// Create blog article pages
@@ -103,8 +103,8 @@ Static paths (or other values) could also be generated programmatically.
103103
// ./src/entries.tsx
104104
import { createPages } from 'waku';
105105

106-
import { getBlogPaths } from './lib/get-blog-paths.js';
107-
import { BlogArticlePage } from './templates/blog-article-page.js';
106+
import { getBlogPaths } from './lib/get-blog-paths';
107+
import { BlogArticlePage } from './templates/blog-article-page';
108108

109109
export default createPages(async ({ createPage }) => {
110110
const blogPaths = await getBlogPaths();
@@ -126,7 +126,7 @@ Routes can contain multiple segments (e.g., `/shop/[category]/[product]`).
126126
// ./src/entries.tsx
127127
import { createPages } from 'waku';
128128

129-
import { ProductDetailPage } from './templates/product-detail-page.js';
129+
import { ProductDetailPage } from './templates/product-detail-page';
130130

131131
export default createPages(async ({ createPage }) => {
132132
// Create product detail pages
@@ -145,7 +145,7 @@ For static prerendering of nested segment routes, the `staticPaths` array is ins
145145
// ./src/entries.tsx
146146
import { createPages } from 'waku';
147147

148-
import { ProductDetailPage } from './templates/product-detail-page.js';
148+
import { ProductDetailPage } from './templates/product-detail-page';
149149

150150
export default createPages(async ({ createPage }) => {
151151
// Create product detail pages
@@ -172,7 +172,7 @@ For example, the `/app/profile/settings` route would receive a `catchAll` prop w
172172
// ./src/entries.tsx
173173
import { createPages } from 'waku';
174174

175-
import { DashboardPage } from './templates/dashboard-page.js';
175+
import { DashboardPage } from './templates/dashboard-page';
176176

177177
export default createPages(async ({ createPage }) => {
178178
// Create account dashboard
@@ -197,7 +197,7 @@ The root layout rendered at `path: '/'` is especially useful. It can be used for
197197
// ./src/entries.tsx
198198
import { createPages } from 'waku';
199199

200-
import { RootLayout } from './templates/root-layout.js';
200+
import { RootLayout } from './templates/root-layout';
201201

202202
export default createPages(async ({ createLayout }) => {
203203
// Add a global header and footer
@@ -213,9 +213,9 @@ export default createPages(async ({ createLayout }) => {
213213
// ./src/templates/root-layout.tsx
214214
import '../styles.css';
215215

216-
import { Providers } from '../components/providers.js';
217-
import { Header } from '../components/header.js';
218-
import { Footer } from '../components/footer.js';
216+
import { Providers } from '../components/providers';
217+
import { Header } from '../components/header';
218+
import { Footer } from '../components/footer';
219219

220220
export const RootLayout = async ({ children }) => {
221221
return (
@@ -251,7 +251,7 @@ Layouts are also helpful further down the tree. For example, you could add a lay
251251
// ./src/entries.tsx
252252
import { createPages } from 'waku';
253253

254-
import { BlogLayout } from './templates/blog-layout.js';
254+
import { BlogLayout } from './templates/blog-layout';
255255

256256
export default createPages(async ({ createLayout }) => {
257257
// Add a sidebar to the blog index and blog article pages
@@ -265,7 +265,7 @@ export default createPages(async ({ createLayout }) => {
265265

266266
```tsx
267267
// ./src/templates/blog-layout.tsx
268-
import { Sidebar } from '../components/sidebar.js';
268+
import { Sidebar } from '../components/sidebar';
269269

270270
export const BlogLayout = async ({ children }) => {
271271
return (

0 commit comments

Comments
 (0)