Routing in Chrome Extension written in React

前端 未结 3 1657
悲&欢浪女
悲&欢浪女 2020-12-31 18:56

I want 2 pages in my Chrome extension. For example: first(default) page with list of users and second with actions for this user.

I want to display second page by cl

3条回答
  •  执念已碎
    2020-12-31 18:58

    I know this post is old. Nevertheless, I'll leave my answer here just in case somebody still looking for it and want a quick answer to fix their existing router.

    In my case, I get away with just switching from BrowserRouter to MemoryRouter. It works like charm without a need of additional memory package!

    import { MemoryRouter as Router } from 'react-router-dom';
    
    ReactDOM.render(
        
            
                
            
        ,
        document.querySelector('#root')
    );
    

    You can try other methods, that suits for you in the ReactRouter Documentation

提交回复
热议问题