INNER CODE UNIT · TypeScript
initialPathValue
margelo/react-native-runtimes · packages/state/src/index.ts:445
function initialPathValue<TValue>(subtreeKey: string): TValue {
return (
subtreeKey === ROOT_SUBTREE_KEY
? initialState
: getValueAtSegments(initialState, pathSegmentsFromKey(subtreeKey))
) as TValue;
}
function getPathState<TValue>(path: SharedStorePath): TValue {
return getValueAtSegments(currentState, normalizePath(path)) as TValue;
}
function patchSubtree<K extends SharedStoreSubtreeKey<TState>>(
subtreeKey: K,
subtreeState: TState[K],
): TState {
return patchPath(subtreeKey, subtreeState);
}