Giter Club home page Giter Club logo

Comments (1)

SimYunSup avatar SimYunSup commented on June 5, 2024 3

새로고침을 하게되면 뒤로가기 버튼이 사라지게 되는데

이 말씀과 영상을 보니 history-sync-plugin을 사용중을 가정하고 답변하겠습니다.
이 라이브러리는 내부에서 windows가 존재할 경우 BrowserRouter를 사용하고 있습니다. 이는 history API 기반으로 되어 있어 새로고침 할 경우 history context를 모두 날리게 됩니다(보안 이슈로 history API에 전 화면의 주소는 가져오지 못합니다).

이에 대응하는 방법은 두가지가 있습니다.

  1. [email protected] 패키지의 createMemoryHistory를 통해 localStorage에 저장하여 history context를 저장해 새로고침 시 history context를 복구하는 history 객체를 만든다. history-sync-plugin의 옵션에 삽입하면 완료.
  2. 커스텀 history를 만든다.

앱 위에서 작동하는 것이라면 새로고침을 방지하는 것 또한 좋은 방법이 될 것 같습니다. 혹여나 무조건 새로고침을 해야하는 상황이라면 위 방법을 검토해보세요 :)

from stackflow.

Related Issues (20)

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.