score:0

Accepted answer

i think it's probably because your useeffect function isn't listening to the query state's chages.

try adding your state query into the useeffect's dependency array, like so:


useeffect( () => {
    getrecipe();
  },[query])

score:1

your ueseffect's dependency array is empty, so it only renders on the very first render since that never changes. i think you meant to put [query] in it. alternatively you could just call the getrecipe() directly in the handlesubmit()


Related Query

More Query from same tag