I have a situation where I have two main 'shells' for pages in my app. The first shell is for the 'unauth' pages login flow (background image, material-ui paper), and the second shell is the main dashboard (navbar, sidebar etc).
The following code is my attempt at simplifying the issue I am running into. Could someone please show me how to properly achieve this with react-router-dom?
<BrowserRouter>
<Switch>
<Route component={Shell1}>
<Route path="/test1" exact component={() => <div>Test 1</div>} />
<Route path="/test2" exact component={() => <div>Test 2</div>} />
</Route>
<Route component={Shell2}>
<Route path="/test3" exact component={() => <div>Test 3</div>} />
<Route path="/test4" exact component={() => <div>Test 4</div>} />
</Route>
</Switch>
</BrowserRouter>
I got this attempt from another StackOverflow post here, but this code above does NOT work. When navigating to /test1, Shell1 (just a div that says Shell1) does NOT display, and /test3 + /test4 do not work at all.
Here's a codeSandbox demonstrating: https://codesandbox.io/s/react-example-362ow
Thanks in advance.