Commit 98bf00d
committed
Add Server Context deprecation warning (#27424)
As agreed, we're removing Server Context. This was never official
documented.
We've found that it's not that useful in practice. Often the better
options are:
- Read things off the url or global scope like params or cookies.
- Use the module system for global dependency injection.
- Use `React.cache()` to dedupe multiple things instead of computing
once and passing down.
There are still legit use cases for Server Context but you have to be
very careful not to pass any large data, so in generally we recommend
against it anyway.
Yes, prop drilling is annoying but it's not impossible for the cases
this is needed. I would personally always pick it over Server Context
anyway.
Semantically, Server Context also blocks object deduping due to how it
plays out with Server Components that can't be deduped. This is much
more important feature.
Since it's already in canary along with the rest of RSC, we're adding a
warning for a few versions before removing completely to help migration.
---------
Co-authored-by: Josh Story <[email protected]>
DiffTrain build for commit 1ebedbe.1 parent e640317 commit 98bf00d
File tree
7 files changed
+18
-10
lines changed- compiled-rn/facebook-fbsource/xplat/js
- RKJSModules/vendor
- react-test-renderer/cjs
- react/cjs
- react-native-github/Libraries/Renderer
7 files changed
+18
-10
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23985 | 23985 | | |
23986 | 23986 | | |
23987 | 23987 | | |
23988 | | - | |
| 23988 | + | |
23989 | 23989 | | |
23990 | 23990 | | |
23991 | 23991 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8620 | 8620 | | |
8621 | 8621 | | |
8622 | 8622 | | |
8623 | | - | |
| 8623 | + | |
8624 | 8624 | | |
8625 | 8625 | | |
8626 | 8626 | | |
| |||
8651 | 8651 | | |
8652 | 8652 | | |
8653 | 8653 | | |
8654 | | - | |
| 8654 | + | |
8655 | 8655 | | |
8656 | 8656 | | |
8657 | 8657 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9046 | 9046 | | |
9047 | 9047 | | |
9048 | 9048 | | |
9049 | | - | |
| 9049 | + | |
9050 | 9050 | | |
9051 | 9051 | | |
9052 | 9052 | | |
| |||
9077 | 9077 | | |
9078 | 9078 | | |
9079 | 9079 | | |
9080 | | - | |
| 9080 | + | |
9081 | 9081 | | |
9082 | 9082 | | |
9083 | 9083 | | |
| |||
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
2706 | 2706 | | |
2707 | 2707 | | |
2708 | 2708 | | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
2709 | 2717 | | |
2710 | 2718 | | |
2711 | 2719 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
619 | | - | |
| 619 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
622 | | - | |
| 622 | + | |
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
0 commit comments