sommeeeR
sommeeeR14mo ago

I want to refetch and set the inital data of an useState

Hello guys, currently i am retrieving the data i use in useState with SSR, but i want to use somethinng that makes it possible to update the useState on interactions from the user. Im guessing I should use useQuery?
How can i set it so initialData in my useState works. this is my current useState line:
const [items, setItems] = useState(cat.CatImage);
const [items, setItems] = useState(cat.CatImage);
3 Replies
Krishna
Krishna13mo ago
This looks good what exactly are you find issue with?
sommeeeR
sommeeeROP13mo ago
I figured it out 😊 I had to set the useQuery with initialData aswell
Krishna
Krishna13mo ago
great 👍

Did you find this page helpful?