인프런 커뮤니티 질문&답변
isServer error 에러가 나왔습니다 ㅠㅠ
작성
·
651
0
antd 가 v4 여서 아이콘을 넣어주려고 아래와 같은 커맨드를 넣었었습니다.
yarn add @ant-design/compatible
그 이후에 갑자기 이런 에러가 나왔어요.
Unhandled Runtime Error
TypeError: Cannot read property 'isServer' of undefined
To set up the editor integration, add something like REACT_EDITOR=atom to the .env.local file in your project folder and restart the development server.
https://github.com/minch1025/Nodebird_kwon
현재 수업은 6-13까지 마친 상태이구요 앤트디 아이콘 넣기 전까지는 동영상과 같이 정상적으로 돌아갔었습니다.
깃 확인 부탁드려요 ㅠㅠㅠ.....
답변 4
1
1. npm i redux-devtools-extension
2. import composeWithDevTools from 'redux-devtools-extension'
export default withRedux((initialState, options) => {
const middlewares = [];
const enhancer = composeWithDevTools(applyMiddleware(...middlewares));
const store = createStore(reducer, initialState, enhancer);
return store;
})(NodeBird);
이렇게 작성했더니 6.0.0 버전에서 잘 작동합니다.
아래 링크 참고했습니다.
0
@ant-design/compatible 추가 했더니 저는 getState 에러 나요.
그래서 공홈에 있는 antd-design/icon 4.1.0 으로 했습니다. 에러 안납니다.
compatible는 왜? 에러나는지 모르겠네요...
0
next-redux-wrapper 버전이 6버전까지 나왔습니다.
버전이 올라가면서 작동방식이 달라진것 같습니다.
https://github.com/kirill-konshin/next-redux-wrapper#upgrade-from-5x-to-6x
Major change in the way how things are wrapped in version 6.
-
Default export
withReduxis marked deprecated, you should create a wrapperconst wrapper = createWrapper(makeStore, {debug: true})and then usewrapper.withRedux(Page). -
Your
makeStorefunction no longer getsinitialState, it only receives the context:makeStore(context: Context). Context could beNextPageContextorAppContextorgetStaticPropsorgetServerSidePropscontext depending on which lifecycle function you will wrap. Instead, you need to handle theHYDRATEaction in the reducer. Thepayloadof this action will contain thestateat the moment of static generation or server side rendering, so your reducer must merge it with existing client state properly. -
Appshould no longer wrap its children withProvider, it is now done internally. -
isServeris not passed incontext/props, use your own function or simple checkconst isServer = typeof window === 'undefined'or!!context.reqor!!context.ctx.req. -
storeis not passed to wrapped component props. -
WrappedAppPropswas renamed toWrapperProps.
버전문제가 아닐까 추측할뿐 ,
저도 아직 해결 하진 못했습니다.
0





