Jarl André
Signals & Data Fetching
i have sort of a similar problem, with data fetching. I think my brain is hardwired for server side data fetching, and, since i know that route components like index.tsx and even _app.tsx is server side rendered, i find it difficult to understand that for ex in Home function in index.tx, that i cannot combine the use of useSignal AND fetch async data at the same time. If i convert the Home function to a function that takes request and context and make it async, the use of useSignal is no longer allowed and i cannot load data asynchronously .. i find it a bit wierd i have such problems grokking this because i have been working on and off backend and frontend for 15 years. Somehow Fresh seems to combine the two worlds in a rather peculiar way.
So, lets say i want to load some data on the server side, for ex before i render the Counter island, in a "fresh" Fresh project, how do i go about changing the Home function in index.tsx?
i propably only need a gentle kick in my leg to understand it, so be gentle 😄
16 replies