-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
리다이렉트 오류가납니다 ㅠㅠ
20.05.10 19:14 작성 조회수 1.24k
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.
Open your browser’s developer console to further inspect this error. Click the 'X' or hit ESC to dismiss this message.
회원가입결과 true가 리턴되는건 확인했는데요 리다이렉트부분이 먹통입니다 ㅠㅠ
뭐가 문제일까요??
답변을 작성해보세요.
1
John Ahn
지식공유자2020.05.10
혹시 withRouter 란것 쓰셨나요 ~ ?
마지막줄에
export default withRouter(RegisterPage)
이걸로 감싸주셔야 합니다
그리고 withRouter는
import { withRouter } from 'react-router-dom';
이렇게 가져와주시면 됩니다 ~!
0
답변 2