Forest.js Core Documentation - v1.2.3
    Preparing search index...

    Type Alias RouterProps<T>

    Properties of the current route. Represents the state and metadata associated with a specific route.

    const { routerStore } = createRouter();

    const app = createForest("#app", () => addChild({ routerStore }, ({ routerStore }) => {
    const { path, state, status } = routerStore; // <- "routerStore" is a RouterProps
    if (status === "loading") {
    return LoadingComponent();
    } else if (path === "/") {
    return HomeComponent();
    } else if (path === "/about") {
    return AboutComponent();
    }
    return NotFoundComponent();
    })(tree("div")));
    type RouterProps<T = any> = {
        path: string;
        state: T;
        status: RouteStatus;
    }

    Type Parameters

    • T = any

      Type of state data associated with the route.

    Index

    Properties

    Properties

    path: string

    The current path of the router.

    state: T

    The state data associated with the current route.

    status: RouteStatus

    The current status of the route.