• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

redux-thunk 관련 오류 !!

23.12.25 11:03 작성 23.12.25 11:04 수정 조회수 358

0

import React from 'react';
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import {Provider} from 'react-redux';
//import 'antd/dist/antd.css'
import { applyMiddleware,createStore } from 'redux';
import promiseMiddleware from 'redux-promise';
import thunk from 'redux-thunk';
import Reducer from './_reducers'
const createStoreWithMiddleware = applyMiddleware(promiseMiddleware,thunk)(createStore)
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
 <Provider store={createStoreWithMiddleware(Reducer,
     window.__REDUX_DEVTOOLS_EXTENSION__ &&
     window.__REDUX_DEVTOOLS_EXTENSION__()
 )}>
    <App />
  </Provider>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
 

위 코드 실행했더니

 

export 'default' (imported as 'thunk') was not found in 'redux-thunk' (possible exports: thunk, withExtraArgument)

 

이란 오류가 떠서 node_modules, package.json 폴더도 삭제하고 다시 npm install을 했음에도 똑같은 오류가 떠요 ㅠ

 

답변 2

·

답변을 작성해보세요.

1

1004님의 프로필

1004

2024.01.09

안녕하세요. 혹시 import 하실 때

import {thunk} from 'redux-thunk';

로도 해보셨나요? 저도 같은 오류가 떴었는데, 강의 속 코드 -> thunk -> {thunk}로 수정하니 오류가 사라지더라고요!

0

인프런 AI 인턴님의 프로필

인프런 AI 인턴

2023.12.25

안녕하세요, 인프런 AI 인턴입니다.

“redux-thunk 관련 오류”에 대한 해결 방법이 필요하신 것으로 보입니다. 비슷한 상황에 대한 질문과 강사님의 답변이 이미 존재하니, 아래 링크를 참조해 보시는 것을 추천드립니다.

해당 질문에서 강사님께서는 모듈 설치 관련 문제를 다시 한번 확인해 볼 것을 제안하셨습니다. 위 링크로 이동하셔서, 강사님의 조언대로 모듈이 제대로 설치되어 있는지 확인하시고, 문제가 해결되지 않을 경우 추가적인 안내를 받으실 수 있습니다.