useEditableValueReducer() — react Function Reference
Architecture documentation for the useEditableValueReducer() function in hooks.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 6a373365_dcc3_7fb5_eb07_8f37a4ad9a9d["useEditableValueReducer()"] 315baf50_1028_51ca_a9c1_679c6a17ed98["hooks.js"] 6a373365_dcc3_7fb5_eb07_8f37a4ad9a9d -->|defined in| 315baf50_1028_51ca_a9c1_679c6a17ed98 2020ba72_aecc_bb93_aaf6_bcaa01730dd1["smartStringify()"] 6a373365_dcc3_7fb5_eb07_8f37a4ad9a9d -->|calls| 2020ba72_aecc_bb93_aaf6_bcaa01730dd1 style 6a373365_dcc3_7fb5_eb07_8f37a4ad9a9d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-shared/src/devtools/views/hooks.js lines 46–79
function useEditableValueReducer(
state: UseEditableValueState,
action: UseEditableValueAction,
) {
switch (action.type) {
case 'RESET':
return {
...state,
editableValue: smartStringify(action.externalValue),
externalValue: action.externalValue,
hasPendingChanges: false,
isValid: true,
parsedValue: action.externalValue,
};
case 'UPDATE':
let isNewValueValid = false;
let newParsedValue;
try {
newParsedValue = smartParse(action.editableValue);
isNewValueValid = true;
} catch (error) {}
return {
...state,
editableValue: sanitizeForParse(action.editableValue),
externalValue: action.externalValue,
hasPendingChanges:
smartStringify(action.externalValue) !== action.editableValue,
isValid: isNewValueValid,
parsedValue: isNewValueValid ? newParsedValue : state.parsedValue,
};
default:
throw new Error(`Invalid action "${action.type}"`);
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does useEditableValueReducer() do?
useEditableValueReducer() is a function in the react codebase, defined in packages/react-devtools-shared/src/devtools/views/hooks.js.
Where is useEditableValueReducer() defined?
useEditableValueReducer() is defined in packages/react-devtools-shared/src/devtools/views/hooks.js at line 46.
What does useEditableValueReducer() call?
useEditableValueReducer() calls 1 function(s): smartStringify.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free