Skip to content

Commit

Permalink
Refine Usage section
Browse files Browse the repository at this point in the history
  • Loading branch information
kyarik committed Dec 27, 2020
1 parent 4213841 commit af7156f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ If you want to use a fetching library that is not compatible with React Suspense
For each route, we need to specify a component, which needs to be the `default` export. For example:

```tsx
const PostPage: RouteComponent<PreloadedPostData> = ({ preloadedData, params }) => {
const PostPage: RouteComponent<PreloadedPost> = ({ preloadedData, params }) => {
const post = preloadedData.read();

if (!post) {
Expand Down Expand Up @@ -100,10 +100,12 @@ Even though all routes can be specified top-level, most apps have a container ar
const Root: RouteComponent = ({ children }) => (
<>
<Header />
<Body>{children}</Body>
<Content>{children}</Content>
<Footer />
</>
);

export default Root;
```

and define it as the top-level route that always matches (so, no `path` is specified) with all the other routes defined as child routes:
Expand Down

0 comments on commit af7156f

Please sign in to comment.