docs: add headers

This commit is contained in:
Corbin Crutchley
2023-12-14 02:38:25 -08:00
parent 19d17a7d97
commit dd34b92a9d

View File

@@ -12,6 +12,8 @@
}
---
# What is Reactivity?
So first - reactivity
When your data changes, it updates the UI automatically using explicit `useState` (or `useReducer`) function calls
@@ -20,9 +22,13 @@ This is "reactivity" - where changes in your logic layer (JS) automatically upda
-------------------------------------------------------------
OK now "reconcilation"
Eventally React needs to know what needs rendering and what doesn't
# What is Reconciliation?
OK now "reconciliation"
Eventually React needs to know what needs rendering and what doesn't
So, for example, say you have:
@@ -41,6 +47,10 @@ But, if you add a `key` in a list, React is able to figure out what elements ass
-----------------------------------------------------------------
# What is SSR?
// Done
OK so now for SSR
By default (CSR), React renders on your user's machine
@@ -71,6 +81,8 @@ So the "traditional" (before today) solution was to render the UI on the server,
-------------------------------------------------------------
# What are React Server Components (RSC)?
So! Instead, what React did is introduce "Server Components", where you can do a few things:
- Not re-render on the client
@@ -102,6 +114,8 @@ So that's the RSC (React Server Component) story
----------------------------------------
# What is React Suspense?
But wait, there's more!
Let's talk about Suspense and data fetching
@@ -153,6 +167,8 @@ And Suspense will automatically show the `fallback` or not, depending on the `fe
-----------------------------------------------------
# What is the React `use` Hook?
Now let's move back to server-land
We know that we can make server-only components, that don't reinitialize on the client, right? Now what if we could load the data on the server and not have it passed to the client either?
@@ -191,6 +207,8 @@ This works!
---------------------------------------------------
# What are React Server Actions?
Now this is great for loading data, but what about actions? Not everything happens at load and we may want to find ourselves listening for a user submitting a form
Well, this is where the React Actions come into play. Let's again move back to client land and see how we can listen for a form submission and add an item to a todo:
@@ -250,6 +268,8 @@ export default function Todo() {
--------------------------------------
# What is the React `useFormState` Hook?
Now this works well if you need to pass data to the server and have it refresh the page
But what happens if you need to display data passed from the server to the client once you do a server action?