Using tanstack table and I am implementing a urlsearchparamas state for date filtering
Unanswered
Long-horned bees posted this in #help-forum
Long-horned beesOP
This is how I am trying to implement url search params for date filtering is it a good way? Will greatly appreciate any feedback. I am using shadcn as base for setting up advanced table. I am using latest nextjs@14.1.0
React.useEffect(() => {
const dateUpdated = searchParams.get("date_updated");
console.log('dateUpdated', dateUpdated)
if (dateUpdated) {
table.getColumn("date_updated")?.setFilterValue(dateUpdated);
}
}, [searchParams.get("date_updated")]);
The above snippet is part of my date table component which am calling from server component page.tsx
I want to know is this a good way of implementing the filtering or am I doing it wrong?
React.useEffect(() => {
const dateUpdated = searchParams.get("date_updated");
console.log('dateUpdated', dateUpdated)
if (dateUpdated) {
table.getColumn("date_updated")?.setFilterValue(dateUpdated);
}
}, [searchParams.get("date_updated")]);
The above snippet is part of my date table component which am calling from server component page.tsx
I want to know is this a good way of implementing the filtering or am I doing it wrong?