React Router Without Changing URL

后端 未结 2 1042
野性不改
野性不改 2020-12-18 20:19

I need to have routing that works without changing the URL.

Before implementing this on my own, I tried to look for something by react router. I sa

2条回答
  •  生来不讨喜
    2020-12-18 21:01

    MemoryHistory is a "history provider", which you can supply to React Router like this:

    const memoryHistory = createMemoryHistory(options);
    
    // In your Router configuration
    
    

    Beyond the initial configuration, everything else should work exactly the same as with regular browser history.

    This article describes how to use different providers with React Router: Histories

提交回复
热议问题