SolidJSS
SolidJS3y ago
43 replies
akerbeltz

typing CreateResource

I would like to do something like this so typescript don't show an error when using it in jsx:
const [data, { mutate }] = createResource<{ dataExample: string } | undefined>(() =>
getData("/api/Example")
);

So i can do:
<p>{data()?.dataExample}</p>
Was this page helpful?