#Fetching data with server$

3 messages · Page 1 of 1 (latest)

stuck pivot
#

What would be the most ideal way to fetch data using server$, and use it in a component?
Say if I have a component Foo and I would like to use the return value of the serverFunc in my template:

export default function Foo() {
  const serverFunc = server$(() => {
    return { hello: 'world' }
  })

  return <h1>Hello from admin index</h1>
}
deft hare
#

Wasn't that the purpose of createServerData$?

icy fern