Files
reacord/docs/app/routes/index.tsx
2021-12-29 11:45:40 -06:00

17 lines
401 B
TypeScript

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>
)
}