I want to build split view functionality so that a user can view multiple components side by side.
In a single view within my application, the react-router URLs are set up like this:
- /user/:id
- /chat/:id
- /etc/:id
How would you implement react-router to work with split view?
There are many different interfaces and I want the user to be able to render any combination of interfaces in any order.
I was thinking about creating a SplitView component which has a childrenComponents prop, which takes an array of components to be rendered. I could possibly set up react-router URLs like:
- /split/
then add a query string to the end
- ?views=%5B%7B%22component%22:%22chat%22,%22id%22:%22123%22%7D,%7B%22component%22:%22chat%22,%22id%22:%22456%22%7D%5D
Which is an encoded, stringified array of JSON objects
[
{
component:'chat',
id:'foo'
},
{
component:'chat',
id:'bar'
}
]
This does not feel like the best approach, does anyone have any suggestions?
Update
After trialing several different approaches, I found that managing multi routes was easier without react-router, and instead just using redux and a well thought out state tree.
However, during my time searching I found a few cool libraries that may help other people out there with similar issues: