Skip to content

Commit

Permalink
Update server-components.md
Browse files Browse the repository at this point in the history
  • Loading branch information
leerob authored Feb 16, 2022
1 parent 5dc8762 commit f5c87e7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/advanced-features/react-18/server-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ To use React Server Components, ensure you have React 18 installed:

```jsx
npm install next@latest react@rc react-dom@rc
```

Then, update your `next.config.js`:

```jsx
// next.config.js
Expand All @@ -29,7 +32,7 @@ To run a component on the server, append `.server.js` to the end of the filename

For client components, append `.client.js` to the filename. For example, `./components/avatar.client.js`.

You can then import other server or client components from any server component. Note: a server component **can not** be imported by a client component. Components without "server/client" extensions will be treated as "universal components" and can be used and rendered by both sides, depending on where it is imported. For example:
You can then import other server or client components from any server component. Note: a server component **can not** be imported by a client component. Components without "server/client" extensions will be treated as shared components and can be used and rendered by both sides, depending on where it is imported. For example:

```jsx
// pages/home.server.js
Expand Down

0 comments on commit f5c87e7

Please sign in to comment.