์ง๋ฌธ ์์ต๋๋ค.
์ง๊ธ ๊ฐ์ ๋ณต์ตํ๋ฉด์ ํ๋๊ฑฐ๋ผ์ redux-saga ๋ฅผ ํ์ฌ ์ฐ๊ณ ์๋ ์ํ์
๋๋ค. function myLocationAPI(latLong) { return axios.get(`https://dapi.kakao.com/v2/local/geo/coord2address.json?x=${latLong.long}&y=${latLong.lat}`, { headers: { "Authorization": "test", }, });}function* myLocation(action) { try { const result = yield call(myLocationAPI, action.data); yield put({ type: MY_LOCATION_SUCCESS, data: result.data.documents[0] }); } catch (e) { yield put({ type: MY_LOCATION_FAILURE, error: e, }); }}function* watchMyLocation() { yield takeLatest(MY_LOCATION_REQUEST, myLocation);} const {mainCardPics, myLocation} = useSelector(state => state.user); dispatch({ type: MY_LOCATION_REQUEST, data: { lat: position.coords.latitude, long: position.coords.longitude, },});console.log("dong : ",myLocation);dispatch({ type: GET_POSTS_REQUEST, data: { dong: myLocation.dong, },}); dispatch ์ก์
์ด ๋๋๋ฉด myLocation ์ ๊ฒฐ๊ณผ ๊ฐ์ด ๋ด๊ฒจ์ผ ๋์ง ์๋์? ๊ทผ๋ฐ ์์ ๊ฐ์ด ํ๋ฉด ๋น ๊ฐ์ฒด๊ฐ ์ฝ์์ ๋์์์