Type error: Its return type 'void | Element' is not a valid JSX element.Type 'void' is not assignable to type 'ReactElement<any, any>'.

JunSeok·2022년 8월 22일
0

bulid하는 과정에서 에러가 발생했다.

구글링한 결과 함수를 사용하는데 리턴값이 없어서 발생하는 것이라 했다.

리턴 결과 값을 함수로 줘서 에러가 발생하고 있었다.

const signupSuccess = () => {
	router.replace('/welcome')
}

//컴포넌트 내의 rendering return
return signupSuccess()

// => 에러 발생

이를 해결하기 위해 리턴 값에서 함수를 제거하고 함수 내의 코드를 집어넣으니 에러가 해결됐다.

return router.replace('/welcome')

// => 해결
profile
최선을 다한다는 것은 할 수 있는 한 가장 핵심을 향한다는 것

0개의 댓글