인프런 커뮤니티 질문&답변
Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
작성
·
4.2K
0
Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
LoginPage
C:/Users/su/Desktop/infran_node_react_practice/client/src/components/views/LoginPage/LoginPage.js:12
9 | const [Password, setPassword] = useState("")
10 |
11 |
> 12 | const dispatch = useDispatch();
| ^ 13 |
14 | const onEmailHandler=(event)=>{
15 | setEmail(event.currentTarget.value);
계속 이렇게 에러가 뜨는데..방법을 모르겠습니다..
해결하신 분 계실까요?
답변 1
0
John Ahn
지식공유자
안녕하세요 index.js 파일이 문제 인것 같은데 ~
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
//import * as serviceWorker from './serviceWorker';
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 ReduxThunk from 'redux-thunk';
import Reducer from './_reducers';
const createStoreWithMiddleware = applyMiddleware(promiseMiddleware,ReduxThunk)(createStore)
ReactDOM.render(
<Provider
store={ createStoreWithMiddleware(Reducer,
window.__REDUX_DEVTOOLS_EXTENSION__ &&
window.__REDUX_DEVTOOLS_EXTENSION__()
)}
>
<App />
</Provider>
,
document.getElementById('root')
);
// 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();
혹시 이런식으로 되어있나요 ?






<provider>부분에서 P를 소문자로 사용해서 생긴 에러였습니다.
답변 감사드립니다~