Debounce props on server component
Unanswered
Eurasian Blackbird posted this in #help-forum
Eurasian BlackbirdOP
Hello,
Does anyone know how to debounce props on a server component ?
Here is an exemple of what I mean :
And I would like to know how only make the fetchProducts every x ms, to not trigger the fetchProducts every time "someFilter" that comes from parent component change ?
I know about use-debounce, and I think this package might do the job, however I'm not sure how to use it on a props...
Thank you
Does anyone know how to debounce props on a server component ?
Here is an exemple of what I mean :
export default async function ProductTable({ someFilter }) {
const products = await fetchProducts(someFilter);
return (
<div>
{products.map(product => <>someJSX</>)}
</div>
)
}And I would like to know how only make the fetchProducts every x ms, to not trigger the fetchProducts every time "someFilter" that comes from parent component change ?
I know about use-debounce, and I think this package might do the job, however I'm not sure how to use it on a props...
Thank you