Skip to content

Instantly share code, notes, and snippets.

@bobdobbs
Created February 27, 2022 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobdobbs/25c68ab7a7405b4f49fb5a0d2de503e4 to your computer and use it in GitHub Desktop.
Save bobdobbs/25c68ab7a7405b4f49fb5a0d2de503e4 to your computer and use it in GitHub Desktop.
// File: /packages/my-first-theme/src/components/index.js
// ...
import Post from "./post"
const Root = ({ state }) => {
const data = state.source.get(state.router.link)
return (
<>
{/* ... */}
<Switch>
<List when={data.isArchive} />
<Post when={data.isPost} />
<Post when={data.isPage} />
</Switch>
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment