set initial data from a different api
I have a filtering system in my website that i use with react query.When users first enter the page i want all of the posts with the most likes to show up but when users filter i want the filtered posts to show up.
For this i figured out to create a state that is set to true if user starts to filter so that when this state is true i will use the filtering api and when it is false i will use the api that gets the posts with most likes.it didnt work.Then i tried initialData but it didnt work either.What would work then.
For this i figured out to create a state that is set to true if user starts to filter so that when this state is true i will use the filtering api and when it is false i will use the api that gets the posts with most likes.it didnt work.Then i tried initialData but it didnt work either.What would work then.