INNER CODE UNIT · TypeScript

patchPath

margelo/react-native-runtimes · packages/state/src/index.ts:437

  function patchPath<TValue>(subtreeKey: string, subtreeState: TValue): TState {
    return setValueAtSegments(
      currentState,
      pathSegmentsFromKey(subtreeKey),
      subtreeState,
    );
  }

  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;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…