function Task(){
const [appliedFilters, setAppliedFilters] = useState()
const {data} = useQuery({
queryKey:["tasks", appliedFilters ]
queryFn:()=>fetchTasks(appliedFilters)
})
return(
<FilterForm onApply={setAppliedFilters} />
)
}
we have to store applyFilter somewhere like useState, when those applied filters change, the queryKey changes, react query will see a new queryKey and then it will fetch the data automatically, and this approach will get us from the imperative thinking like if i click that button, i want to do some fetching towards the declarative form of you know i want data that matches this state.