MCPcopy Index your code
hub / github.com/react/react / inspectHooksOfForwardRef

Function inspectHooksOfForwardRef

packages/react-debug-tools/src/ReactDebugHooks.js:1256–1281  ·  view source on GitHub ↗
(
  renderFunction: (Props, Ref) => React$Node,
  props: Props,
  ref: Ref,
  currentDispatcher: CurrentDispatcherRef,
)

Source from the content-addressed store, hash-verified

1254}
1255
1256function inspectHooksOfForwardRef<Props, Ref>(
1257 renderFunction: (Props, Ref) => React$Node,
1258 props: Props,
1259 ref: Ref,
1260 currentDispatcher: CurrentDispatcherRef,
1261): HooksTree {
1262 const previousDispatcher = currentDispatcher.H;
1263 let readHookLog;
1264 currentDispatcher.H = DispatcherProxy;
1265 let ancestorStackError;
1266 try {
1267 ancestorStackError = new Error();
1268 renderFunction(props, ref);
1269 } catch (error) {
1270 handleRenderFunctionError(error);
1271 } finally {
1272 readHookLog = hookLog;
1273 hookLog = [];
1274 currentDispatcher.H = previousDispatcher;
1275 }
1276 const rootStack =
1277 ancestorStackError === undefined
1278 ? ([]: ParsedStackFrame[])
1279 : ErrorStackParser.parse(ancestorStackError);
1280 return buildTree(rootStack, readHookLog);
1281}
1282
1283function resolveDefaultProps(Component: any, baseProps: any) {
1284 if (Component && Component.defaultProps) {

Callers 1

inspectHooksOfFiberFunction · 0.85

Calls 2

buildTreeFunction · 0.85

Tested by

no test coverage detected