|
1 | 1 | import React, { StrictMode, useState } from 'react';
|
2 | 2 | import { render } from 'react-dom';
|
3 | 3 | import { css } from '@linaria/core';
|
4 |
| -import { HashRouter as Router, Switch, Redirect, Route } from 'react-router-dom'; |
| 4 | +import { HashRouter as Router, Routes, Route, Navigate } from 'react-router-dom'; |
5 | 5 |
|
6 | 6 | import type { Direction } from '../src/types';
|
7 | 7 | import Nav from './Nav';
|
@@ -88,64 +88,31 @@ function Root() {
|
88 | 88 | <Router>
|
89 | 89 | <Nav direction={direction} onDirectionChange={setDirection} />
|
90 | 90 | <main className={mainClassname} dir={direction}>
|
91 |
| - <Switch> |
92 |
| - <Redirect exact from="/" to="/common-features" /> |
93 |
| - <Route exact path="/common-features"> |
94 |
| - <CommonFeatures direction={direction} /> |
95 |
| - </Route> |
96 |
| - <Route exact path="/all-features"> |
97 |
| - <AllFeatures direction={direction} /> |
98 |
| - </Route> |
99 |
| - <Route exact path="/cell-navigation"> |
100 |
| - <CellNavigation direction={direction} /> |
101 |
| - </Route> |
102 |
| - <Route exact path="/column-spanning"> |
103 |
| - <ColumnSpanning direction={direction} /> |
104 |
| - </Route> |
105 |
| - <Route exact path="/columns-reordering"> |
106 |
| - <ColumnsReordering direction={direction} /> |
107 |
| - </Route> |
108 |
| - <Route exact path="/context-menu"> |
109 |
| - <ContextMenuDemo direction={direction} /> |
110 |
| - </Route> |
111 |
| - <Route exact path="/customizable-components"> |
112 |
| - <CustomizableComponents direction={direction} /> |
113 |
| - </Route> |
114 |
| - <Route exact path="/grouping"> |
115 |
| - <Grouping direction={direction} /> |
116 |
| - </Route> |
117 |
| - <Route exact path="/header-filters"> |
118 |
| - <HeaderFilters direction={direction} /> |
119 |
| - </Route> |
120 |
| - <Route exact path="/infinite-scrolling"> |
121 |
| - <InfiniteScrolling direction={direction} /> |
122 |
| - </Route> |
123 |
| - <Route exact path="/master-detail"> |
124 |
| - <MasterDetail direction={direction} /> |
125 |
| - </Route> |
126 |
| - <Route exact path="/million-cells"> |
127 |
| - <MillionCells direction={direction} /> |
128 |
| - </Route> |
129 |
| - <Route exact path="/no-rows"> |
130 |
| - <NoRows direction={direction} /> |
131 |
| - </Route> |
132 |
| - <Route exact path="/resizable-grid"> |
133 |
| - <ResizableGrid direction={direction} /> |
134 |
| - </Route> |
135 |
| - <Route exact path="/rows-reordering"> |
136 |
| - <RowsReordering direction={direction} /> |
137 |
| - </Route> |
138 |
| - <Route exact path="/scroll-to-row"> |
139 |
| - <ScrollToRow direction={direction} /> |
140 |
| - </Route> |
141 |
| - <Route exact path="/tree-view"> |
142 |
| - <TreeView direction={direction} /> |
143 |
| - </Route> |
144 |
| - <Route exact path="/variable-row-height"> |
145 |
| - <VariableRowHeight direction={direction} /> |
146 |
| - </Route> |
147 |
| - <Route>Nothing to see here</Route> |
148 |
| - </Switch> |
| 91 | + <Routes> |
| 92 | + <Route index element={<Navigate to="common-features" replace />} /> |
| 93 | + <Route path="common-features" element={<CommonFeatures direction={direction} />} /> |
| 94 | + <Route path="all-features" element={<AllFeatures direction={direction} />} /> |
| 95 | + <Route path="cell-navigation" element={<CellNavigation direction={direction} />} /> |
| 96 | + <Route path="column-spanning" element={<ColumnSpanning direction={direction} />} /> |
| 97 | + <Route path="columns-reordering" element={<ColumnsReordering direction={direction} />} /> |
| 98 | + <Route path="context-menu" element={<ContextMenuDemo direction={direction} />} /> |
| 99 | + <Route |
| 100 | + path="customizable-components" |
| 101 | + element={<CustomizableComponents direction={direction} />} |
| 102 | + /> |
| 103 | + <Route path="grouping" element={<Grouping direction={direction} />} /> |
| 104 | + <Route path="header-filters" element={<HeaderFilters direction={direction} />} /> |
| 105 | + <Route path="infinite-scrolling" element={<InfiniteScrolling direction={direction} />} /> |
| 106 | + <Route path="master-detail" element={<MasterDetail direction={direction} />} /> |
| 107 | + <Route path="million-cells" element={<MillionCells direction={direction} />} /> |
| 108 | + <Route path="no-rows" element={<NoRows direction={direction} />} /> |
| 109 | + <Route path="resizable-grid" element={<ResizableGrid direction={direction} />} /> |
| 110 | + <Route path="rows-reordering" element={<RowsReordering direction={direction} />} /> |
| 111 | + <Route path="scroll-to-row" element={<ScrollToRow direction={direction} />} /> |
| 112 | + <Route path="tree-view" element={<TreeView direction={direction} />} /> |
| 113 | + <Route path="variable-row-height" element={<VariableRowHeight direction={direction} />} /> |
| 114 | + <Route path="*" element="Nothing to see here" /> |
| 115 | + </Routes> |
149 | 116 | </main>
|
150 | 117 | </Router>
|
151 | 118 | );
|
|
0 commit comments