Type Route

Type Route

  • Docs
  • GitHub
  • v0.6.0

›Types

Introduction

  • Getting Started
  • Simple React Example

Guides

  • Code Splitting
  • Complex Route Parameters
  • Custom Link Behavior
  • Custom Query String
  • Data Fetching
  • Nested and Similar Routes
  • No Match (404)
  • Page Layout
  • Preventing Navigation
  • Programmatic Navigation
  • Redirects
  • Rendering Links
  • Route Parameters
  • Scroll Restoration
  • Server Side Rendering
  • Styling of Links for the Currently Active Route
  • Type Route without React
  • Wildcard Routes
  • Previous Release Docs
  • Guide Missing?

API Reference

    <ParameterDefinition>

    • param

    <RouteDefinition>

    • defineRoute
    • extend

    <RouteGroup>

    • createGroup
    • has

    <Route>

    • action
    • href
    • link
    • name
    • params
    • push
    • replace

    <Router>

    • createRouter
    • useRoute
    • RouteProvider
    • routes
    • session

    Types

    • Link
    • QueryStringSerializer
    • Route
    • RouterOpts
    • SessionOpts
    • ValueSerializer

    Miscellaneous

    • noMatch
    • preventDefaultLinkClickBehavior
Edit

RouterOpts

type RouterOpts = {
  /**
   * Options for what variety of browser history session you're using.
   * There are three types with additional options depending on the
   * session type: "browser", "hash", and "memory".
   */
  session?: SessionConfig;

  /**
   * A custom serializer/deserializer for the query string. This is an
   * advanced feature your application likely does not need.
   *
   * @see https://typehero.org/type-route/docs/guides/custom-query-string
   */
  queryStringSerializer?: QueryStringSerializer;

  /**
   * Object used to configure how arrays are serialized to the url.
   */
  arrayFormat?: ArrayFormat;

  /**
   * A path segment that precedes every route in your application. When using a "hash"
   * router this segment will come before the "#" symbol.
   */
  baseUrl?: string;
}

type ArrayFormat = {
    /**
   * Separator to use for array parameter types. By default ","
   */
  separator?: string;

  /**
   * Query string serialization method.
   *
   * @see https://typehero.org/type-route/docs/guides/custom-query-string
   */
  queryString?: QueryStringArrayFormat;
}

type QueryStringArrayFormat =
  | "singleKey"
  | "singleKeyWithBracket"
  | "multiKey"
  | "multiKeyWithBracket"
← RouteSessionOpts →
Type Route is a Type Hero project  ·  Copyright © 2020