Skip to content

Commit 0b330d5

Browse files
committed
Commit missing controller
1 parent dd32432 commit 0b330d5

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

lib/components_guide_web/controllers/react_typescript_controller.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ defmodule ComponentsGuideWeb.ReactTypescriptController do
1010
@articles %{
1111
"testing" => %{title: "Testing React"},
1212
"forms" => %{title: "Creating Forms in React"},
13+
"state-levels" => %{title: "Levels of State in React"},
1314
"reducer-patterns" => %{title: "React Reducer Patterns"},
15+
"form-reducers" => %{title: "Form Validation with React Reducers"},
1416
"zero-hook-dependencies" => %{title: "Zero Hook Dependencies"},
1517
"hooks-concurrent-world" => %{title: "React Hooks in a Concurrent World"},
1618
"logical-clocks" => %{title: "Logical Clocks in React"},
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# React State
2+
3+
## Derive local variable
4+
5+
## useState
6+
7+
## useReducer
8+
9+
## useSyncExternalStore
10+
11+
```ts
12+
function useIsOffline(): boolean {
13+
const isOnline = useSyncExternalStore(
14+
(callback: () => void) => {
15+
window.addEventListener("offline", callback);
16+
17+
return () => {
18+
window.removeEventListener("offline", callback);
19+
};
20+
},
21+
() => navigator.onLine,
22+
() => true
23+
);
24+
return !isOnline;
25+
}
26+
```
27+
28+
## Root prop
29+
30+
## createContext

0 commit comments

Comments
 (0)