import type { MetaFunction, LoaderArgs, LinksFunction } from '@remix-run/node'
import { json } from '@remix-run/node'
import {
Links,
LiveReload,
Meta,
Outlet,
Scripts,
ScrollRestoration,
useCatch,
useMatches,
useTransition
} from '@remix-run/react'
import { useEffect } from 'react'
import NProgress from 'nprogress'
import nProgressStylesUrl from 'nprogress/nprogress.css'
import { getUser } from './session.server'
export const meta: MetaFunction = () => ({
charset: 'utf-8',
title: 'New Remix App',
viewport: 'width=device-width,initial-scale=1'
})
export let links: LinksFunction = () => {
return [{ rel: 'stylesheet', href: nProgressStylesUrl }]
}
export async function loader({ request }: LoaderArgs) {
return json({
user: await getUser(request)
})
}
export default function App() {
let transition = useTransition()
useEffect(() => {
if (transition.state === 'idle') NProgress.done()
else NProgress.start()
}, [transition.state])
return (
{message}
{error.message}
Hey, developer, you should replace this with what you want your users to see.