Skip to content

Instantly share code, notes, and snippets.

@jthrilly
Last active December 6, 2021 19:24
Show Gist options
  • Save jthrilly/76cdf20737cfff25b847c8504cb486b1 to your computer and use it in GitHub Desktop.
Save jthrilly/76cdf20737cfff25b847c8504cb486b1 to your computer and use it in GitHub Desktop.
R34 Sample Screen Structure
// Main router (App.js) might look like this:
<Switch location={location} key={location.pathname}>
<Route exact path="/">
<Home />
</Route>
<Route exact path="/data-quality">
<DataQuality />
</Route>
<Route exact path="/background">
<Background />
</Route>
<Route exact path="/trust-and-disclosure">
<TrustAndDisclosure />
</Route>
<Route exact path="/efficiency">
<Efficiency />
</Route>
</Switch>
// Stream component might look like this:
let { path, url } = useRouteMatch();
<Stream>
<Switch>
<Route exact path={path}> // Root 'page'. e.g website.com/stream/
<DataQualityIntro>
</Route>
<Route path={`${path}/some-page`}>
<SomePage>
</Route>
</Switch>
</Stream>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment