T
TanStack4w ago
flat-fuchsia

Make queries reactive

When passing a query object to a component like this:
const dataQuery = useQuery(() => ({
queryKey: ['price'],
queryFn: fetchStoragePrice,
}))
// ...
<Match when={dataQuery.isSuccess}>
<StoragePriceDisplay
{...{ capacityUnit, timeUnit }}
storagePrice={dataQuery.data!}
bzzPrice={bzzPrice}
unit={() => `${currency()}/${capacityUnit()}-${timeUnit()}`}
/>
const dataQuery = useQuery(() => ({
queryKey: ['price'],
queryFn: fetchStoragePrice,
}))
// ...
<Match when={dataQuery.isSuccess}>
<StoragePriceDisplay
{...{ capacityUnit, timeUnit }}
storagePrice={dataQuery.data!}
bzzPrice={bzzPrice}
unit={() => `${currency()}/${capacityUnit()}-${timeUnit()}`}
/>
it doesn't react to changes of the data. passing the whole object doesn't work either. do i have to wrap every single query into a signal in order for components to react to changes?
1 Reply
genetic-orange
genetic-orange2w ago
That should be reactive... what part isn't reactive? What do Match and StoragePriceDisplay look like?

Did you find this page helpful?