export default function Myperson() { const [name] = createResource(() => db.selectFrom('person').selectAll().where("id" , "=" , 1).execute() ) return ( <div> <Suspense fallback="loading..."> {name()} </Suspense> </div> );}
const [name , setName] = createSignal('Loading...')async function getName(id: number) { const x = await db.selectFrom('person').selectAll().where("id" , "=" , id).execute(); await console.log(x[0].first_name) await setName(x[0].first_name);}export default function Myperson() { getName(1); return ( <div> {name()} </div> );}
export default function Myperson() { const [name , setName] = createSignal('Loading...') setName(getName(1)) return ( <div> {name()} </div> );}