MCPcopy
hub / github.com/facebook/react / read

Function read

packages/react-devtools-shared/src/devtools/cache.js:138–161  ·  view source on GitHub ↗
(input: Input)

Source from the content-addressed store, hash-verified

136 },
137
138 read(input: Input): Value {
139 // Prevent access outside of render.
140 readContext(CacheContext);
141
142 const key = hashInput(input);
143 const result: Thenable<Value> = accessResult(resource, fetch, input, key);
144 if (typeof React.use === 'function') {
145 // eslint-disable-next-line react-hooks-published/rules-of-hooks
146 return React.use(result);
147 }
148
149 switch (result.status) {
150 case 'fulfilled': {
151 const value = result.value;
152 return value;
153 }
154 case 'rejected': {
155 const error = result.reason;
156 throw error;
157 }
158 default:
159 throw result;
160 }
161 },
162
163 preload(input: Input): void {
164 // Prevent access outside of render.

Callers 1

OwnersStack.jsFile · 0.50

Calls 2

accessResultFunction · 0.70
readContextFunction · 0.50

Tested by

no test coverage detected