import { setServerData, getServerData } from 'one'
type SafeURLs = `${`https://tamagui.dev` | `http://localhost`}${string}
const useFetch = async (url: SafeURLs) => {
if (process.env.VITE_ENVIRONMENT === 'ssr') {
setServerData(url, await fetch(url).then(res => res.json()))
}
return getServerData(url)
}
export default async (props) => {
const serverData = await useFetch(props.url)
return <div />
}
export const loader = async ({ params }) => {
await doSomething()
setServerData(params.idl, 'data')
return {}
}