Commit 773bb4a
committed
Support writing to this.refs from userspace
Previously, the `refs` property of a class component instance was
read-only by user code — only React could write to it, and until/unless
a string ref was used, it pointed to a shared empty object that was
frozen in dev to prevent userspace mutations.
Because string refs are deprecated, we want users to be able to codemod
all their string refs to callback refs. The safest way to do this is to
output a callback ref that assigns to `this.refs`.
So to support this, we need to make `this.refs` writable by userspace.1 parent 0061ca6 commit 773bb4a
File tree
3 files changed
+30
-13
lines changed- packages
- react-reconciler/src
- __tests__
- react/src
3 files changed
+30
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
819 | 819 | | |
820 | 820 | | |
821 | 821 | | |
822 | | - | |
823 | 822 | | |
824 | 823 | | |
825 | 824 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
141 | 165 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | 11 | | |
17 | 12 | | |
18 | 13 | | |
19 | 14 | | |
20 | 15 | | |
21 | 16 | | |
22 | | - | |
23 | | - | |
| 17 | + | |
24 | 18 | | |
25 | 19 | | |
26 | 20 | | |
| |||
53 | 47 | | |
54 | 48 | | |
55 | 49 | | |
56 | | - | |
| 50 | + | |
57 | 51 | | |
58 | 52 | | |
59 | 53 | | |
| |||
82 | 76 | | |
83 | 77 | | |
84 | 78 | | |
85 | | - | |
| 79 | + | |
86 | 80 | | |
87 | 81 | | |
88 | 82 | | |
| |||
104 | 98 | | |
105 | 99 | | |
106 | 100 | | |
107 | | - | |
| 101 | + | |
108 | 102 | | |
109 | | - | |
| 103 | + | |
110 | 104 | | |
111 | 105 | | |
112 | 106 | | |
| |||
133 | 127 | | |
134 | 128 | | |
135 | 129 | | |
136 | | - | |
| 130 | + | |
137 | 131 | | |
138 | 132 | | |
139 | 133 | | |
| |||
0 commit comments