effex-monorepo
    Preparing search index...

    Variable Navigation

    Navigation: {
        back: Effect<void, never, NavigationContext>;
        buildPath: <P, SP, D, E, R>(
            route: Route<string, P, SP, D, E, R>,
            params: P,
            searchParams?: SP,
        ) => string;
        Context: typeof NavigationContext;
        currentMatch: Effect<CurrentMatch, never, NavigationContext>;
        forward: Effect<void, never, NavigationContext>;
        make: <
            P extends Record<string, unknown>,
            S extends Record<string, unknown>,
            D,
            E,
            R,
        >(
            router: Router<P, S, D, E, R>,
            options?: NavigationOptions,
        ) => Effect<Navigation, never, Scope>;
        makeLayer: <
            P extends Record<string, unknown>,
            S extends Record<string, unknown>,
            D,
            E,
            R,
        >(
            router: Router<P, S, D, E, R>,
            options?: NavigationOptions,
        ) => Layer<NavigationContext, never, never>;
        pathname: Effect<string, never, NavigationContext>;
        pushPath: (path: string) => Effect<void, never, NavigationContext>;
        pushRoute: <P, SP, D, E, R>(
            route: Route<string, P, SP, D, E, R>,
            options?: RouteNavigateOptions<P, SP>,
        ) => Effect<void, never, NavigationContext>;
        replacePath: (path: string) => Effect<void, never, NavigationContext>;
        replaceRoute: <P, SP, D, E, R>(
            route: Route<string, P, SP, D, E, R>,
            options?: RouteNavigateOptions<P, SP>,
        ) => Effect<void, never, NavigationContext>;
        searchParams: Effect<URLSearchParams, never, NavigationContext>;
    }

    Type Declaration

    • back: Effect<void, never, NavigationContext>

      Go back in history.

    • buildPath: <P, SP, D, E, R>(
          route: Route<string, P, SP, D, E, R>,
          params: P,
          searchParams?: SP,
      ) => string

      Build a path string from a route and params. Replaces :param segments with actual values and appends search params.

    • Context: typeof NavigationContext
    • currentMatch: Effect<CurrentMatch, never, NavigationContext>

      Get the current matched route.

    • forward: Effect<void, never, NavigationContext>

      Go forward in history.

    • make: <P extends Record<string, unknown>, S extends Record<string, unknown>, D, E, R>(
          router: Router<P, S, D, E, R>,
          options?: NavigationOptions,
      ) => Effect<Navigation, never, Scope>

      Create a Navigation service for a router.

      const NavigationLive = Navigation.makeLayer(router);

      // In your app
      Effect.gen(function* () {
      const nav = yield* NavigationContext;
      const path = yield* nav.pathname.get;
      yield* nav.pushRoute(UserRoute, { params: { id: 123 } });
      }).pipe(Effect.provide(NavigationLive));
    • makeLayer: <P extends Record<string, unknown>, S extends Record<string, unknown>, D, E, R>(
          router: Router<P, S, D, E, R>,
          options?: NavigationOptions,
      ) => Layer<NavigationContext, never, never>

      Create a Layer that provides Navigation for a router.

    • pathname: Effect<string, never, NavigationContext>

      Get the current pathname.

    • pushPath: (path: string) => Effect<void, never, NavigationContext>

      Navigate to a path.

    • pushRoute: <P, SP, D, E, R>(
          route: Route<string, P, SP, D, E, R>,
          options?: RouteNavigateOptions<P, SP>,
      ) => Effect<void, never, NavigationContext>

      Navigate to a route with type-safe params.

    • replacePath: (path: string) => Effect<void, never, NavigationContext>

      Navigate to a path, replacing current history entry.

    • replaceRoute: <P, SP, D, E, R>(
          route: Route<string, P, SP, D, E, R>,
          options?: RouteNavigateOptions<P, SP>,
      ) => Effect<void, never, NavigationContext>

      Navigate to a route, replacing current history entry, with type-safe params.

    • searchParams: Effect<URLSearchParams, never, NavigationContext>

      Get the current search params.