Serve another(standalone) page or static file in website built with react

前端 未结 6 1613
陌清茗
陌清茗 2021-02-02 09:53

I have a website built with react, which uses react-router. For some route I want to serve another page or static file, but since all request are forwarded to react router, its

6条回答
  •  孤街浪徒
    2021-02-02 10:22

    This should work:

    const reload = () => window.location.reload();
    
    
      // all your routes..
      ...
    
      // Your special routes..
      
      
    
    

    So, I think this should be pretty clear what it does ;)

    Update:

    if this is an option you can simply put target="_blank" attribute in your

    IMHO this is from the UX perspective even better, because if these routes are not part of your main application, the user can just switch the Tab after visiting that special pages.

提交回复
热议问题