-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into fix-dedupe-head
- Loading branch information
Showing
69 changed files
with
991 additions
and
743 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,38 @@ | ||
import React from 'react' | ||
import NoSSR from 'react-no-ssr' | ||
import React, { useEffect, useState } from 'react' | ||
import Loading from '../components/Loading' | ||
|
||
export default () => ( | ||
<main> | ||
<section> | ||
<h1>This section is server-side rendered.</h1> | ||
</section> | ||
function useMounted() { | ||
const [mounted, setMounted] = useState(false) | ||
useEffect(() => setMounted(true), []) | ||
return mounted | ||
} | ||
|
||
<NoSSR onSSR={<Loading />}> | ||
export default function HomePage() { | ||
const isMounted = useMounted() | ||
return ( | ||
<main> | ||
<section> | ||
<h2> | ||
This section is <em>only</em> client-side rendered. | ||
</h2> | ||
<h1>This section is server-side rendered.</h1> | ||
</section> | ||
</NoSSR> | ||
|
||
<style jsx>{` | ||
section { | ||
align-items: center; | ||
display: flex; | ||
height: 50vh; | ||
justify-content: center; | ||
} | ||
`}</style> | ||
</main> | ||
) | ||
{isMounted ? ( | ||
<section> | ||
<h2> | ||
This section is <em>only</em> client-side rendered. | ||
</h2> | ||
</section> | ||
) : ( | ||
<Loading /> | ||
)} | ||
|
||
<style jsx>{` | ||
section { | ||
align-items: center; | ||
display: flex; | ||
height: 50vh; | ||
justify-content: center; | ||
} | ||
`}</style> | ||
</main> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.