create remix project
This commit is contained in:
16
docs/app/routes/index.tsx
Normal file
16
docs/app/routes/index.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { readFile } from "fs/promises"
|
||||
import { json, LoaderFunction, useLoaderData } from "remix"
|
||||
|
||||
export const loader: LoaderFunction = async () => {
|
||||
const docs = await readFile("app/docs.json", "utf8")
|
||||
return json(JSON.parse(docs))
|
||||
}
|
||||
|
||||
export default function Index() {
|
||||
const data = useLoaderData()
|
||||
return (
|
||||
<main>
|
||||
<pre>{JSON.stringify(data, undefined, 2)}</pre>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user