react-keepalive-router icon indicating copy to clipboard operation
react-keepalive-router copied to clipboard

useParams无效

Open bosens-China opened this issue 2 years ago • 0 comments

router

    <Suspense fallback={Loading}>
      <BrowserRouter>
        <KeepaliveRouterSwitch>
          <Route strict exact path="/user/login">
            <Login />
          </Route>
          <Route strict exact path="/redirect" component={Redirect404} />

          <KeepaliveRoute strict exact path="/patient/list">
            <Layout>
              <List />
            </Layout>
          </KeepaliveRoute>
          <KeepaliveRoute strict exact path="/patient/:id/record/overview">
            <Layout>
              <ListStudy />
            </Layout>
          </KeepaliveRoute>
          <KeepaliveRoute strict exact path="/patient/analysis">
            <Layout>
              <Analysis />
            </Layout>
          </KeepaliveRoute>
          <Redirect from="/*" to="/redirect" />
        </KeepaliveRouterSwitch>
      </BrowserRouter>
    </Suspense>

使用

import { useParams } from 'react-router-dom';
 const { id } = useParams();
// ?undefined

bosens-China avatar Sep 03 '21 03:09 bosens-China