nareshbhatia / mobx-state-router

MobX-powered router for React apps
https://nareshbhatia.github.io/mobx-state-router/
MIT License
227 stars 30 forks source link

Complex Hierarchy #67

Closed upschmidtcreek closed 5 years ago

upschmidtcreek commented 5 years ago

Hi Naresh, thank you for putting this together and sharing it with everyone. I was going to build a router using Mobx myself until I came across your repo. I've taken a look at your examples and I have a question.

With a site that has a complex page/view/component hierarchy, do you have any examples or thoughts on how I could accomplish something like the below?

app/
    /global nav
    /page
         /sidebar
        /view
           /nav
          /view
              /view
              /components

In your examples, each route was a page and there were no examples of dynamic hierarchy based routing that could provide additional routing within a page view or component.

Would I need to create a router for each? PageRouter, ViewRouter?

<App>
    <GlobalNav />
    <PageRouter>
        <PageNav />
        <ViewRouter>
            <Views />
        </ViewRouter>
        <PageFooter />
    </PageRouter>
</App>

Thanks in advance for any feedback.

In addition to this, I've put together some examples of your router using Functions/Hooks instead of having to inject Mobx into each component. Let me know if you want me to submit a PR to add some of those examples to your repo. Thanks again for putting this together.

Brian