<Switch/>

Description

<Switch/> component is a component that decides which component should be mounted based on currentPath. (See RouterContext page.)

Basic Usage

<Switch/> takes only <Route/> components as its children.

SwitchExample.jsx
import React from 'react'
import {Switch, Router} from 'react-queue-router'

import Top from './Top'
import About from './About'
import NotFound from './NotFound'

const SwitchExample = () => {
  return (
    <Switch>
      <Router path='/' component='Top'>
      <Router path='/about' component='About'>
      <Router component='NotFound'>
    </Switch>
  )
 }
 
export default SwitchExample

Options

PropertyType of valueDefault valueRequiredDescription
rememberScrollBooleanfalse-

Experimental

When true, scroll position will be stored and you can come back to the right position when hitting "back" button or "forward" button.

This is an experimental feature. All cases are not supported.