You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Initialize counter for the default naming. If user use reactHook, such as useState, react will only pass in the value, and not the name of the state.
277
+
letstateCounter=1;
278
+
for(consthookof_debugHookTypes){
279
+
if(reactHooks.has(hook)){
280
+
letstateData=memoizedState?.memoizedState;
281
+
// ReactHook condition:
282
+
if(typeofstateData!=='object'){
283
+
constdefaultName=`state${stateCounter}`;
284
+
stateData={[defaultName]: stateData};
285
+
stateCounter++;
286
+
}
287
+
// If user does not use reactHook => state is store in memoizedState array, at i = 0
288
+
else{
289
+
stateData=stateData[0];
290
+
}
291
+
//Trim the current level of memoizedState data:
292
+
console.log({ stateData });
293
+
convertDataToString(stateData,reactimeStateData);
294
+
}
272
295
//Move on to the next level:
273
296
memoizedState=memoizedState?.next;
274
297
}
275
298
276
-
returnreactimeContextData;
299
+
returnreactimeStateData;
277
300
}
278
301
// -------------------------CREATE TREE TO SEND TO FRONT END--------------------
279
302
/**
@@ -319,7 +342,8 @@ function createTree(
319
342
elementType,
320
343
memoizedProps,
321
344
memoizedState,
322
-
dependencies,
345
+
stateNode,
346
+
// dependencies,
323
347
_debugHookTypes,
324
348
});
325
349
@@ -367,20 +391,43 @@ function createTree(
367
391
*/
368
392
// const filteredComponents = tag != ContextProvider;
369
393
constfilteredComponents=true;
394
+
395
+
// ----------------APPEND PROP DATA FROM REACT DEV TOOL-----------------------
370
396
// check to see if the parent component has any state/props
// if user uses useContext hook, context data will be stored in memoizedProps.value of the Context.Provider component => grab context object stored in memoizedprops
410
+
// Different from other provider, such as Routes, BrowswerRouter, ReactRedux, ..., Context.Provider does not have a displayName
0 commit comments