Created
November 17, 2022 12:39
-
-
Save Zegnat/ce89fcd11448a29db7ac52f0c62efb19 to your computer and use it in GitHub Desktop.
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
GET http://localhost:7331/test | |
An unhandler error occured: TypeError: /Users/martijn/Source/thumbswise/src/routes/test.tsx: Duplicate declaration "createRouteData" | |
> 1 | import { createRouteData, useRouteData } from "solid-start"; | |
| ^^^^^^^^^^^^^^^ | |
2 | import { createServerData$ } from "solid-start/server"; | |
3 | | |
4 | export function routeData() { |
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
// src/routes/test.tsx | |
import { createRouteData, useRouteData } from "solid-start"; | |
import { createServerData$ } from "solid-start/server"; | |
export function routeData() { | |
const firstDataPoint = createRouteData(async () => "createRouteData"); | |
const secondDataPoint = createServerData$(async () => "createServerData$"); | |
return { firstDataPoint, secondDataPoint }; | |
} | |
export default function Page() { | |
const { firstDataPoint, secondDataPoint } = useRouteData<typeof routeData>(); | |
return ( | |
<ol> | |
<li>{firstDataPoint}</li> | |
<li>{secondDataPoint}</li> | |
</ol> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment