• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>

21.06.17 11:07 작성 조회수 3.95k

0

Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
<button style="cursor:pointer;display:block;width:991px;text-align:left;font-family:Consolas, Menlo, monospace;font-size:1em;padding:0px;line-height:1.5;color:white;background:#353535;margin-bottom:1.5em;border:initial none initial">▶ 3 stack frames were collapsed.</button>
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);
<button style="margin-bottom:1.5em;color:#878e91;cursor:pointer;display:block;width:991px;text-align:left;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-attachment:initial;background-origin:initial;background-clip:initial;font-family:Consolas, Menlo, monospace;font-size:1em;padding:0px;line-height:1.5;border:initial none initial">View compiled</button>
계속 이렇게 에러가 뜨는데..방법을 모르겠습니다..
해결하신 분 계실까요?

답변 1

답변을 작성해보세요.

0

안녕하세요   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();


혹시 이런식으로 되어있나요 ?

water Yi님의 프로필

water Yi

질문자

2021.06.22

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

답변 감사드립니다~