def add_page(
        self,
        component: Component | ComponentCallable | None = None,
        route: str | None = None,
        title: str | Var | None = None,
        description: str | Var | None = None,
        image: str = constants.DefaultPage.IMAGE,
        on_load: EventType[()] | None = None,
        meta: list[dict[str, str]] = constants.DefaultPage.META_LIST,
        context: dict[str, Any] | None = None,
    ):
        """Add a page to the app.

        If the component is a callable, by default the route is the name of the
        function. Otherwise, a route must be provided.

        Args:
            component: The component to display at the page.
            route: The route to display the component at.
            title: The title of the page.
            description: The description of the page.
            image: The image to display on the page.
            on_load: The event handler(s) that will be called each time the page load.
            meta: The metadata of the page.
            context: Values passed to page for custom page-specific logic.

        Raises:
            PageValueError: When the component is not set for a non-404 page.
            RouteValueError: When the specified route name already exists.
        """
        # If the route is not set, get it from the callable.
        if route is None:
            if not isinstance(component, Callable):
                msg = "Route must be set if component is not a callable."
                raise exceptions.RouteValueError(msg)
            # Format the route.
            route = format.format_route(component.__name__)
        else:
            route = format.format_route(route, format_case=False)

        if route == constants.Page404.SLUG:
            if component is None:
                component = Default404Page.create()
            component = wait_for_client_redirect(self._generate_component(component))
            title = title or constants.Page404.TITLE
            description = description or constants.Page404.DESCRIPTION
            image = image or constants.Page404.IMAGE
        else:
            if component is None:
                msg = "Component must be set for a non-404 page."
                raise exceptions.PageValueError(msg)

        # Check if the route given is valid
        verify_route_validity(route)

        unevaluated_page = UnevaluatedPage(
            component=component,
            route=route,
            title=title,
            description=description,
            image=image,
            on_load=on_load,
            meta=meta,
            context=context,
        )

        if route in self._unevaluated_pages:
            if self._unevaluated_pages[route].component is component:
                unevaluated_page = unevaluated_page.merged_with(
                    self._unevaluated_pages[route]
                )
                console.warn(
                    f"Page {route} is being redefined with the same component."
                )
            else:
                route_name = (
                    f"`{route}` or `/`"
                    if route == constants.PageNames.INDEX_ROUTE
                    else f"`{route}`"
                )
                existing_component = self._unevaluated_pages[route].component
                msg = (
                    f"Tried to add page {readable_name_from_component(component)} with route {route_name} but "
                    f"page {readable_name_from_component(existing_component)} with the same route already exists. "
                    "Make sure you do not have two pages with the same route."
                )
                raise exceptions.RouteValueError(msg)

        # Setup dynamic args for the route.
        # this state assignment is only required for tests using the deprecated state kwarg for App
        state = self._state if self._state else State
        state.setup_dynamic_args(get_route_args(route))

        if on_load:
            self._load_events[route] = (
                on_load if isinstance(on_load, list) else [on_load]
            )

        self._unevaluated_pages[route] = unevaluated_page
Add a page to the app.

        If the component is a callable, by default the route is the name of the
        function. Otherwise, a route must be provided.

        Args:
            component: The component to display at the page.
            route: The route to display the component at.
            title: The title of the page.
            description: The description of the page.
            image: The image to display on the page.
            on_load: The event handler(s) that will be called each time the page load.
            meta: The metadata of the page.
            context: Values passed to page for custom page-specific logic.

        Raises:
            PageValueError: When the component is not set for a non-404 page.
            RouteValueError: When the specified route name already exists.
        
reflex/app.py