-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
59 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import React from 'react'; | ||
|
||
export const NonceContext = React.createContext<string | undefined>(undefined); |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { defer } from "@remix-run/node"; | ||
import { Await, useLoaderData } from "@remix-run/react"; | ||
import { Suspense } from "react"; | ||
|
||
export const loader = () => { | ||
return defer({ | ||
critical: "data", | ||
slowPromise: new Promise((resolve) => setTimeout(() => resolve('Slow promise content'), 1000)), | ||
}); | ||
}; | ||
|
||
export default function Defer() { | ||
const data = useLoaderData<typeof loader>(); | ||
|
||
return ( | ||
<div> | ||
<Suspense fallback={<p>Loading deffered content</p>}> | ||
<Await | ||
resolve={data.slowPromise} | ||
errorElement={<p>Error loading deffered content!</p>} | ||
> | ||
{(content) => ( | ||
<p> | ||
{content} | ||
</p> | ||
)} | ||
</Await> | ||
</Suspense> | ||
</div> | ||
); | ||
} |
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,32 +1,10 @@ | ||
import { Link } from "@remix-run/react"; | ||
|
||
export default function Index() { | ||
return ( | ||
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}> | ||
<h1>Welcome to Remix</h1> | ||
<ul> | ||
<li> | ||
<a | ||
target="_blank" | ||
href="https://remix.run/tutorials/blog" | ||
rel="noreferrer" | ||
> | ||
15m Quickstart Blog Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
target="_blank" | ||
href="https://remix.run/tutorials/jokes" | ||
rel="noreferrer" | ||
> | ||
Deep Dive Jokes App Tutorial | ||
</a> | ||
</li> | ||
<li> | ||
<a target="_blank" href="https://remix.run/docs" rel="noreferrer"> | ||
Remix Docs | ||
</a> | ||
</li> | ||
</ul> | ||
<Link to="/defer">Go to defer</Link> | ||
</div> | ||
); | ||
} |