Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Rewrite Rendering Section and React Essentials Page #51579

Merged
merged 74 commits into from Aug 24, 2023

Conversation

delbaoliveira
Copy link
Contributor

@delbaoliveira delbaoliveira commented Jun 20, 2023

We initially wrote the React page to introduce Server Components in the App Router, but over time, some implementation details have changed, and the information has become stale. The React team is working on adding new docs, so I'd like to change the narrative on the Next.js docs from "client vs. server components" to "writing code for the server and for the client" - and link back to the React documentation when it becomes available.

As React developers, we're very familiar with writing code for the client, it's nice and simple. But doing so comes at the expense of not being familiar with the server. The aim of these docs is to help developers become proficient in both the client and server environments.

I'd like to take it back to the foundations, and not use abstractions like SSG and CSR, MPAs or SPAs, as those terms come with their own set of assumptions that make it harder to understand how RSC works. Instead, we'll focus on the request lifecycle, show how application code flows from the server to the client, and discuss the trade-offs of doing operations in each environment.

  • Page: Rendering Fundamentals
    • Environments: Client and Server
    • Request-response lifecycle
    • Network Boundary
  • Page: Server Components
    • Benefits and use cases of server rendering
    • How to use Server Components in Next.js
    • How Server Components are rendered
    • Static Rendering
    • Dynamic Rendering
    • Streaming
  • Page: Client Components
    • Benefits and use cases of client rendering
    • How to use Client Components in Next.js
    • How Client Components are rendered
      • Initial vs. Subsquent navigation
  • Page: Composition Patterns
    • When to use client and server components
    • Server Component Patterns
    • Client Component Patterns
    • Interleaving Client and Server Components
  • Diagrams will follow up with new PR.
  • Set up redirects: https://github.com/vercel/front/pull/24917

@vercel-spaces
Copy link

vercel-spaces bot commented Jun 20, 2023

Notifying the following users due to files changed in this PR:

@timneutkens, @ijjk, @shuding, @huozhi, @feedthejim:

docs/01-getting-started/03-react-essentials/01-server-and-client-components.mdx
docs/01-getting-started/03-react-essentials/02-rendering-deep-dive.mdx
docs/01-getting-started/03-react-essentials/03-suspense-and-streaming.mdx
docs/01-getting-started/03-react-essentials/04-async-components.mdx
docs/01-getting-started/03-react-essentials/05-composition-patterns.mdx
docs/01-getting-started/03-react-essentials/06-client-and-server-packages.mdx
docs/01-getting-started/03-react-essentials/index.mdx

This comment was posted based on the notify modifier.

@delbaoliveira delbaoliveira marked this pull request as draft June 20, 2023 16:46
@github-actions
Copy link
Contributor

github-actions bot commented Jun 20, 2023

All broken links are now fixed, thank you!

kodiakhq bot pushed a commit that referenced this pull request Jul 31, 2023
This PR document the caching semantics in Next.js, how they interact, and what APIs affect them. We're also taking the opportunity to consolidate terminology, remove duplicate content, and update sections of the docs that relate to caching. 

### Documentation

- [x] Create a new section for caching
- [x] Explain how the different caching mechanisms work
   - [x] Request Memoization (React Cache)
   - [x] Persistent Data Cache 
   - [x] Persistent Full Route Cache 
   - [x] In-memory, client-side Router Cache 
- [x] Document how different APIs affect caching
- [x] Document cache interactions 
- [x] Clean up stale information in the other docs sections
   - [x] Routing Section
      - [x] Move advanced navigation topics from fundamentals to **How Navigation Works** section
      - [x] Rewrite the **How Navigation Works** section
   - [x] Rendering Section
      - [x] Simplify fundamentals page
      - [x] Rewrite the **Static and Dynamic Rendering** pages
      - [ ] ~Create a page to explain how **Client and Server Components** are rendered~. Moved to this PR: #51579
   - [x] Data fetching section 
      - [x] Consolidate data fetching story for fetching, caching, and revalidating
      - [x] Clarify data fetching story with 3rd party libraries and React `cache`
      - [x] Create **Data Fetching Patterns** page
- [x] Document other related behaviors: 
   - [x] Update information on scroll position for back/forward navigation 
   - [x] Remove the concepts of **soft and hard navigation**
   - [x] Remove the concepts of **static and dynamic data fetching**
   - [x] Use consistent terminology **runtime** 👉🏼  **request time**. Runtime for Edge and Node.js, request time to describe when dynamic stuff happens
   - [x] `generateStaticParams` being able to seed the Full Route Cache
- [x] Polish 💅🏼 

---
### Related PRs:

- Diagrams: vercel/front#24142
- Redirects: vercel/front#24179
@delbaoliveira delbaoliveira changed the title [WIP] Rewrite React Essentials Page [WIP] Docs: Rewrite React Essentials Page Aug 1, 2023
@delbaoliveira delbaoliveira changed the title [WIP] Docs: Rewrite React Essentials Page [WIP] Docs: Rewrite Rendering Section and React Essentials Page Aug 1, 2023
@delbaoliveira
Copy link
Contributor Author

Ok, these changes are ready for review 🎉

I'll work on diagrams separately.

…r-components.mdx

Co-authored-by: Michael Novotny <manovotny@gmail.com>
@manovotny
Copy link
Contributor

I see there is still a Set up redirect for React Essentials Page checkbox, but I saw a couple of others we might want too.

@AndKenneth
Copy link

This is going to be an absolute game changer when released. It totally reaches to the heart of the concepts and is going to unlock a lot of understanding. Amazing work @delbaoliveira, honestly can't wait.

Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@delbaoliveira
Copy link
Contributor Author

Thank you @AndKenneth ❤️

@leerob leerob changed the title [WIP] Docs: Rewrite Rendering Section and React Essentials Page docs: Rewrite Rendering Section and React Essentials Page Aug 24, 2023
@leerob leerob merged commit 1dc5c06 into canary Aug 24, 2023
54 checks passed
@leerob leerob deleted the docs-react-essentials-revamp branch August 24, 2023 13:48
@leerob
Copy link
Member

leerob commented Aug 24, 2023

Great work @delbaoliveira 👏

@github-actions github-actions bot added the locked label Sep 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet