ryu110
@ryu110

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

React-router-dom v6 detailpage開きたい

下記のようにidを渡していますが、url上では問題なくidまで表示されますが、elementに設定したDetailPostにならないです。
なぜでしょうか

export const RouterList = () => {
  return (
    <Routes>
      <Route path={`/`} element={<Home />}>
        <Route path={`/detailPost/:detailId`} element={<DetailPost />} />
        <Route path={`/createPost/`} element={<CreatePost />} />
        <Route path={`/createProfile/`} element={<CreateProfile />} />
      </Route>
    </Routes>
  );
};
return (
    <div style={{ padding: "100px" }}>
      <Grid container spacing={3}>
        {data.postWithFilesPagination.map((el: any, index: number) => (
          <Grid item xs={2} sm={4} md={4} key={index}>
            <CustomLink to={`/detailPost/${el.id}`}>
              <Item>ファイル: {el.filePath}</Item>
              <Item style={{ fontWeight: "bold" }}>タイトル: {el.title}</Item>
            </CustomLink>
          </Grid>
        ))}
      </Grid>
      <Pagination count={totalPages} page={page} onChange={handleChange} />
    </div>
  );
};

0

No Answers yet.

Your answer might help someone💌