[에러] Argument of type '() => Promise<void>' is not assignable to parameter of type 'EffectCallback'

옥수수의 코딩이야기·2023년 2월 5일
0

에러

목록 보기
4/18
post-thumbnail
useEffect(() => {
		// 선택된 건물 유형 options
		switch (largeBuildingType) {
			case '아파트': {
				dispatch(
					registerRoomActions.setBuildingType(apartmentBuildingTypeList[0])
				);
				return setDetailBuildingOptions(apartmentBuildingTypeList);
			}
           (...)
	}, [largeBuildingType]);

작업중 패널에 useEffect에 문제가 떴다.
문제:

해결방안:

	useEffect(() => {
        (async () => {
            switch (largeBuildingType) {  
                 (...)

참고
문제의 코드 참고) https://github.com/BBD810/next-bnb/blob/main/components/room/register/RegisterRoomBuilding.tsx
해결방안)
return 사용) https://www.appsloveworld.com/reactjs/100/38/argument-of-type-promisevoid-is-not-assignable-to-parameter-of-ty
async 사용) https://github.com/developerasun/pawcon/issues/48

profile
프론트엔드 공부중 기억은 블로그가 대신합니다.

0개의 댓글