Skip to content

Commit c24bdc4

Browse files
committed
refine docs and make space for docs on contexts
1 parent f821c96 commit c24bdc4

File tree

13 files changed

+108
-35
lines changed

13 files changed

+108
-35
lines changed

docs/source/_static/css/furo-theme-overrides.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ body {
44
}
55

66
.sidebar-container {
7-
width: 16em;
7+
width: 18em;
88
}

docs/source/adding-interactivity/components-with-state/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ it. The parent component can’t change it. This lets you add state to any compo
340340
remove it without impacting the rest of the components.
341341

342342
.. card::
343-
:link: /managing-state/shared-component-state/index
343+
:link: /managing-state/sharing-component-state/index
344344
:link-type: doc
345345

346346
:octicon:`book` Read More

docs/source/escape-hatches/class-components.rst

-13
This file was deleted.

docs/source/escape-hatches/index.rst

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Escape Hatches
44
.. toctree::
55
:hidden:
66

7-
class-components
87
javascript-components
98
distributing-javascript
109
writing-your-own-server
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Combining Contexts and Reducers 🚧
2+
==================================
3+
4+
.. note::
5+
6+
Under construction 🚧
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Deeply Sharing State with Contexts 🚧
2+
=====================================
3+
4+
.. note::
5+
6+
Under construction 🚧

docs/source/managing-state/structuring-your-state/index.rst renamed to docs/source/managing-state/how-to-structure-state/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.. _Structuring Your State:
22

3-
Structuring Your State 🚧
3+
How to Structure State 🚧
44
=========================
55

66
.. note::

docs/source/managing-state/index.rst

+76-10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ Managing State
44
.. toctree::
55
:hidden:
66

7-
structuring-your-state/index
8-
shared-component-state/index
7+
how-to-structure-state/index
8+
sharing-component-state/index
99
when-and-how-to-reset-state/index
10+
simplifying-updates-with-reducers/index
11+
deeply-sharing-state-with-contexts/index
12+
combining-contexts-and-reducers/index
1013

1114
.. dropdown:: :octicon:`bookmark-fill;2em` What You'll Learn
1215
:color: info
@@ -15,14 +18,15 @@ Managing State
1518

1619
.. grid:: 1 2 2 2
1720

18-
.. grid-item-card:: :octicon:`code-square` Structuring Your State
19-
:link: structuring-your-state/index
21+
.. grid-item-card:: :octicon:`organization` How to Structure State
22+
:link: how-to-structure-state/index
2023
:link-type: doc
2124

22-
Make it easy to reason about your application by organizing its state.
25+
Make it easy to reason about your application with strategies for organizing
26+
state.
2327

24-
.. grid-item-card:: :octicon:`link` Shared Component State
25-
:link: shared-component-state/index
28+
.. grid-item-card:: :octicon:`link` Sharing Component State
29+
:link: sharing-component-state/index
2630
:link-type: doc
2731

2832
Allow components to vary vary together, by lifting state into common
@@ -35,8 +39,37 @@ Managing State
3539
Control if and how state is preserved by understanding it's relationship to
3640
the "UI tree".
3741

42+
.. grid-item-card:: :octicon:`plug` Simplifying Updates with Reducers
43+
:link: simplifying-updates-with-reducers/index
44+
:link-type: doc
45+
46+
Consolidate state update logic outside your component in a single function,
47+
called a “reducer".
48+
49+
.. grid-item-card:: :octicon:`broadcast` Deeply Sharing State with Contexts
50+
:link: deeply-sharing-state-with-contexts/index
51+
:link-type: doc
52+
53+
Instead of passing shared state down deep component trees, bring state into
54+
"contexts" instead.
55+
56+
.. grid-item-card:: :octicon:`rocket` Combining Contexts and Reducers
57+
:link: combining-contexts-and-reducers/index
58+
:link-type: doc
59+
60+
You can combine reducers and context together to manage state of a complex
61+
screen.
3862

39-
Section 4: Shared Component State
63+
64+
Section 1: How to Structure State
65+
---------------------------------
66+
67+
.. note::
68+
69+
Under construction 🚧
70+
71+
72+
Section 2: Shared Component State
4073
---------------------------------
4174

4275
Sometimes, you want the state of two components to always change together. To do it,
@@ -49,13 +82,46 @@ state, the state represents the food name. Note how the component ``Table`` gets
4982
at each change of state. The component is observing the state and reacting to state
5083
changes automatically, just like it would do in React.
5184

52-
.. idom:: shared-component-state/_examples/synced_inputs
85+
.. idom:: sharing-component-state/_examples/synced_inputs
5386

5487
.. card::
55-
:link: shared-component-state/index
88+
:link: sharing-component-state/index
5689
:link-type: doc
5790

5891
:octicon:`book` Read More
5992
^^^^^^^^^^^^^^^^^^^^^^^^^
6093

6194
Allow components to vary vary together, by lifting state into common parents.
95+
96+
97+
Section 3: When and How to Reset State
98+
--------------------------------------
99+
100+
.. note::
101+
102+
Under construction 🚧
103+
104+
105+
Section 4: Simplifying Updates with Reducers
106+
--------------------------------------------
107+
108+
.. note::
109+
110+
Under construction 🚧
111+
112+
113+
Section 5: Deeply Sharing State with Contexts
114+
---------------------------------------------
115+
116+
.. note::
117+
118+
Under construction 🚧
119+
120+
121+
122+
Section 6: Combining Contexts and Reducers
123+
------------------------------------------
124+
125+
.. note::
126+
127+
Under construction 🚧

docs/source/managing-state/shared-component-state/index.rst renamed to docs/source/managing-state/sharing-component-state/index.rst

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
Shared Component State
2-
======================
1+
Sharing Component State
2+
=======================
33

4+
.. note::
5+
6+
Parts of this document are still under construction 🚧
7+
8+
Sometimes, you want the state of two components to always change together. To do it,
9+
remove state from both of them, move it to their closest common parent, and then pass it
10+
down to them via props. This is known as “lifting state up”, and it’s one of the most
11+
common things you will do writing code with IDOM.
412

5-
Sometimes you want the state of two components to always change together. To do it, you
6-
need to be able to share state between those two components, to share state between
7-
components move state to the nearest parent. In React world this is known as "lifting
8-
state up" and it is a very common thing to do. Let's look at 2 examples, also from
9-
`React <https://beta.reactjs.org/learn/sharing-state-between-components>`__,
10-
but translated to IDOM.
1113

1214
Synced Inputs
1315
-------------
@@ -18,6 +20,7 @@ and ``set_value`` variables.
1820

1921
.. idom:: _examples/synced_inputs
2022

23+
2124
Filterable List
2225
----------------
2326

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Simplifying Updates with Reducers 🚧
2+
====================================
3+
4+
.. note::
5+
6+
Under construction 🚧

0 commit comments

Comments
 (0)