Skip to content

Commit 5fd16c7

Browse files
leerobdelbaoliveiramolebox
authored
docs: SPAs (vercel#74605)
This documents how to build Single-Page Applications with Next.js. --------- Co-authored-by: Delba de Oliveira <32464864+delbaoliveira@users.noreply.github.com> Co-authored-by: Rich Haines <hello@richardhaines.dev>
1 parent 66059a4 commit 5fd16c7

File tree

6 files changed

+435
-6
lines changed

6 files changed

+435
-6
lines changed

docs/01-app/03-building-your-application/02-data-fetching/03-server-actions-and-mutations.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,20 @@ export async function create() {}
6060
export async function create() {}
6161
```
6262

63-
```tsx filename="app/ui/button.tsx" switcher
63+
```tsx filename="app/button.tsx" switcher
6464
'use client'
6565

66-
import { create } from '@/app/actions'
66+
import { create } from './actions'
6767

6868
export function Button() {
6969
return <button onClick={() => create()}>Create</button>
7070
}
7171
```
7272

73-
```jsx filename="app/ui/button.js" switcher
73+
```jsx filename="app/button.js" switcher
7474
'use client'
7575

76-
import { create } from '@/app/actions'
76+
import { create } from './actions'
7777

7878
export function Button() {
7979
return <button onClick={() => create()}>Create</button>

docs/01-app/03-building-your-application/06-optimizing/07-lazy-loading.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function ClientComponentExample() {
5757

5858
### Skipping SSR
5959

60-
When using `React.lazy()` and Suspense, Client Components will be pre-rendered (SSR) by default.
60+
When using `React.lazy()` and Suspense, Client Components will be [prerendered](https://github.com/reactwg/server-components/discussions/4) (SSR) by default.
6161

6262
> **Note:** `ssr: false` option will only work for client components, move it into client components ensure the client code-splitting working properly.
6363

docs/01-app/03-building-your-application/10-deploying/02-static-exports.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const nextConfig = {
3535
module.exports = nextConfig
3636
```
3737

38-
After running `next build`, Next.js will produce an `out` folder which contains the HTML/CSS/JS assets for your application.
38+
After running `next build`, Next.js will create an `out` folder with the HTML/CSS/JS assets for your application.
3939

4040
<PagesOnly>
4141

docs/01-app/03-building-your-application/11-upgrading/05-app-router-migration.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,10 @@ export async function GET(request) {}
878878

879879
> **Good to know**: If you previously used API routes to call an external API from the client, you can now use [Server Components](/docs/app/building-your-application/rendering/server-components) instead to securely fetch data. Learn more about [data fetching](/docs/app/building-your-application/data-fetching/fetching).
880880
881+
#### Single-Page Applications
882+
883+
If you are also migrating to Next.js from a Single-Page Application (SPA) at the same time, see our [documentation](/docs/app/building-your-application/upgrading/single-page-applications) to learn more.
884+
881885
### Step 7: Styling
882886

883887
In the `pages` directory, global stylesheets are restricted to only `pages/_app.js`. With the `app` directory, this restriction has been lifted. Global styles can be added to any layout, page, or component.

docs/01-app/03-building-your-application/11-upgrading/06-from-create-react-app.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Migrating from Create React App
3+
nav_title: Migrating from CRA
34
description: Learn how to migrate your existing React application from Create React App to Next.js.
45
---
56

0 commit comments

Comments
 (0)