Giter VIP home page Giter VIP logo

mr-camel's People

Contributors

bohyunkang avatar daeun-react avatar eyes0n avatar skawnkk avatar

mr-camel's Issues

Error: ProductDetail 페이지에서 새로고침 시 에러 발생

ProductDetail 페이지에서 새로고침 시 에러 발생 원인:

componentDidMount에서 setState로 해당 product를 저장하게 만들었으나
새로 고침 시 render -> componentDidMount 로 진행될 때
render에서 참조하는 product는 빈 객체이기 때문

디버깅으로 이러한 현상의 원인을 찾았는데 새로고침 시 context가 빈 배열로 할당됨

내가 생각한 흐름:

  1. 새로고침 발생
  2. app이 새로 빌드됨
  3. app 빌드되면서 productContext도 같이 빌드되어 해당 context에 100개의 상품이 할당
  4. 상세 페이지(productDetail)에서 contextAPI로 100개 상품을 참조
  5. 그 이후 로직들 실행

새로 고침 전 정상 흐름

list페이지에서 새로고침 전, 후 확인한 context 유무
image

detail페이지에서 새로고침 전 확인한 context 유무
image

새로 고침 후 발생한 에러

detail페이지 새로고침 후 확인한 context 유무
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.