-
-
Notifications
You must be signed in to change notification settings - Fork 746
Closed
Labels
questionQuestion about functionalityQuestion about functionality
Description
Search terms
default value of a nested param, complex param
Question
How can I show default value of a function param nested object ?
Here's my code
/**
* A custom hook for managing asynchronous data in an external store with synchronous state.
*
* @param selector - The selector for the asynchronous data.
* @param config - Optional configuration options.
*/
export const useAsyncV = (
selector: string,
config: { initialState: { data: any; loading: boolean; error: boolean } } = {
initialState: { data: null, loading: false, error: false },
}
) => {
// Get initial state from config
const initialState = config.initialState;
update(store, selector, (p: any) => {
if (typeof p === "object") {
if ("data" in p && "loading" in p && "error" in p) return p;
return { ...p, ...initialState };
}
return initialState;
});
// Get the synchronous state object for the given selector
const state = useSyncV(selector);
// Return the synchronous state object
return state;
};
I want theresulting html to show my default param value
{
initialState: { data: null, loading: false, error: false }
}
Is there any way I can do that ?
Metadata
Metadata
Assignees
Labels
questionQuestion about functionalityQuestion about functionality