• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

isServer error 에러가 나왔습니다 ㅠㅠ

20.05.15 08:33 작성 조회수 477

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

KS Michael님의 프로필

KS Michael

2020.05.16

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

KS Michael님의 프로필

KS Michael

2020.05.16

@ant-design/compatible 추가 했더니 저는 getState 에러 나요.

그래서 공홈에 있는 antd-design/icon   4.1.0 으로 했습니다. 에러 안납니다.

compatible는 왜? 에러나는지 모르겠네요...

0

KS Michael님의 프로필

KS Michael

2020.05.16

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.

  1. Default export withRedux is marked deprecated, you should create a wrapper const wrapper = createWrapper(makeStore, {debug: true}) and then use wrapper.withRedux(Page).

  2. Your makeStore function no longer gets initialState, it only receives the context: makeStore(context: Context). Context could be NextPageContext or AppContext or getStaticProps or getServerSideProps context depending on which lifecycle function you will wrap. Instead, you need to handle the HYDRATE action in the reducer. The payload of this action will contain the state at the moment of static generation or server side rendering, so your reducer must merge it with existing client state properly.

  3. App should no longer wrap its children with Provider, it is now done internally.

  4. isServer is not passed in context/props, use your own function or simple check const isServer = typeof window === 'undefined' or !!context.req or !!context.ctx.req.

  5. store is not passed to wrapped component props.

  6. WrappedAppProps was renamed to WrapperProps.

버전문제가 아닐까 추측할뿐 ,

저도 아직 해결 하진 못했습니다. 

0

설치만 했는데 갑자기 저 에러가 뜰리가 없습니다. 어떤 부분 코드를 수정하셨나요?