File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -311,3 +311,22 @@ On this page you learned:
311
311
<br >
312
312
313
313
314
+ ### Scaling Up with Reducer and Context
315
+
316
+ ## Recap[ ] ( https://react.dev/learn/scaling-up-with-reducer-and-context#recap " Link for Recap ")
317
+
318
+ - You can combine reducer with context to let any component read and update state above it.
319
+ - To provide state and the dispatch function to components below:
320
+ 1 . Create two contexts (for state and for dispatch functions).
321
+ 2 . Provide both contexts from the component that uses the reducer.
322
+ 3 . Use either context from components that need to read them.
323
+ - You can further declutter the components by moving all wiring into one file.
324
+ - You can export a component like ` TasksProvider ` that provides context.
325
+ - You can also export custom Hooks like ` useTasks ` and ` useTasksDispatch ` to read it.
326
+ - You can have many context-reducer pairs like this in your app.
327
+
328
+ * link: https://react.dev/learn/scaling-up-with-reducer-and-context *
329
+
330
+ <br >
331
+
332
+
You can’t perform that action at this time.
0 commit comments