Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 24 /@:username 이슈 #382

Open
velopert opened this issue Apr 23, 2023 · 0 comments
Open

Chapter 24 /@:username 이슈 #382

velopert opened this issue Apr 23, 2023 · 0 comments
Labels
고정 해결됐으나, 쉽게 참고 할 수 있도록 고정

Comments

@velopert
Copy link
Owner

리액트 라우터 6.5 에서 @가 들어가는 형태의 파라미터 지원을 없앴다고 합니다.

따라서, App.js 에서

      <Route path="/:username">
        <Route index element={<PostListPage />} />
        <Route path=":postId" element={<PostPage />} />
      </Route>

이렇게 /@:username -> /:username 으로 바꿔주세요.

그리고 이후 username을 사용해야 할 때는 다음과 같이 코드를 작성하시면 됩니다.

  const params = useParams();
  const username = params.username.split('@')[1];

이 커밋을 참조하세요.

1c8b308

@velopert velopert added the 고정 해결됐으나, 쉽게 참고 할 수 있도록 고정 label Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
고정 해결됐으나, 쉽게 참고 할 수 있도록 고정
Projects
None yet
Development

No branches or pull requests

1 participant