강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của rlaqud9k6721
rlaqud9k6721

câu hỏi đã được viết

Chuỗi Node và React để học theo - Bài giảng cơ bản

Bài giảng cơ bản về Node React #31 Trang đăng ký thành viên

리다이렉트 오류가납니다 ㅠㅠ

Viết

·

1.4K

1

×

Unhandled Rejection (TypeError): Cannot read property 'push' of undefined
(anonymous function)
C:/Users/rlaqu/OneDrive/Desktop/boiler-plate/client/src/components/views/RegisterPage/RegisterPage.js:50
  542 | };
543 | dispatch(Object(_action_user_action__WEBPACK_IMPORTED_MODULE_2__["registerUser"])(body)).then(response => {
544 | if (response.payload.success) {
> 545 | props.history.push('/login');
| ^ 546 | } else {
547 | alert('failed to sign up');
548 | }
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error. Click the 'X' or hit ESC to dismiss this message.
회원가입결과 true가 리턴되는건 확인했는데요 리다이렉트부분이 먹통입니다 ㅠㅠ
뭐가 문제일까요??
reactnodejs

Câu trả lời 2

1

John Ahn님의 프로필 이미지
John Ahn
Người chia sẻ kiến thức

혹시  withRouter 란것 쓰셨나요 ~ ?

마지막줄에  

export default withRouter(RegisterPage)

이걸로 감싸주셔야 합니다 

그리고 withRouter는 

import { withRouter } from 'react-router-dom';

이렇게 가져와주시면 됩니다 ~! 

0

rlaqud9k6721님의 프로필 이미지
rlaqud9k6721
Người đặt câu hỏi

아 마지막줄에 감싸줘야하는거군요 감사합니다

이제 제대로 돌아가는 페이지를 보니 가슴이 웅장해지네요 ㅠㅠ

Hình ảnh hồ sơ của rlaqud9k6721
rlaqud9k6721

câu hỏi đã được viết

Đặt câu hỏi