Skip to content

useParams无效 #7

@bosens-China

Description

@bosens-China

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions