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()
Source: stackoverflow.com
Related Query
- Form submit not working for the React Food App
- the state inside hooks are not updated for first time on form submit in react
- React router not working after building the app
- Recharts is not working for the React with typescript
- React Native + Expo + Axios file upload not working because axios is not sending the form data to the server
- React router after adding createBrowserHistory, the app is not working as expected
- "this" is undefined for a form after submit but not for button in react
- React Routes not working after building the app using webpack
- Storing layout for my react app in local storage not working
- Debouncing in react is not working if I directly call the function containing logic for setTimeout
- Why is the preventDefault() method not working for me in my react application?
- React form not displaying the correct inputs on the screen after I click submit button
- While doing form validation on submit a form, the component is not updating in React
- Bootstrap modal not working in React typescript app but working on the fiddle
- Create React App proxy to express server for PassportJS not working
- React App only re-renders on first state change and changes are not visible for second change even though the change is successful
- React browserhistory.push not working for the first time
- @CrossOrigin(origins = { "*" }) not working for Springboot + React app
- During on submit of the form throws Objects are not valid as a React child
- preventDefault not working when form submit react js
- I have a react app but for whatever reason the Navbar is stuck at the bottom of the page not in the header
- React form refreshes the entire page onSubmit and setState not working
- React Hook Form - Errors not working for multiple forms on a single page for react hook form v7.5.2
- How to submit a React form on <select> element change, but keep validation for other inputs in the form?
- React useState not updating the states on submit form
- How to have button in the form which check for required fields on submit but does not refresh the page?
- e.preventDefault not working when I trigger it from Submit button but working when triggered from onSubmit attribute in Form tag in React
- Why Multiple Remote federation module is not working for multiple remote child react app and a parent app?
- I was submitting the form in react but it was not taking the first submit, it was showing blank. And required attribute is also not working
- Heroku environment variables are not visible for the react app
More Query from same tag
- React.lazy() with Typescript
- How to use react-draggable with material-ui animations with react-transition group
- How to fix the clumped up text? How to fix the background not going all the way down?
- In ReactJS, a simple inline styling not giving desired output
- Call Action with props in ComponentDidMount
- React streamich / react-use upsert example
- react-bootstrap edit input fields in a Modal after it's done displaying initial data
- How can I disable the click event after the div is clicked in react?
- axios API call after file is ready
- Class constructor l cannot be invoked without 'new'
- TypeScript React event handler error; type is not assignable to type (union)
- Cannot redirect to error Page in ReactJS although I added Link tag
- Why isn't `useContext` re-rendering my component?
- Error while deploying Next.js on vercel: Unexpected token R in JSON at position 0
- Snap.svg easing in Gatsby
- font-face not working in any browser
- ReactJs browser Cannot read property 'keys' of undefined
- React reset state after filtering with onClick
- Possible to render components in reverse manner in JSX?
- Webpack LESS loader, happens after page render
- How to generate path to imported file in React dynamically
- My datepicker wont change its value in react hooks
- Props Uncaught TypeError: Cannot read property 'name' of undefined
- Using document.querySelector in React? Should I use refs instead? How?
- In React, using bootstrap modal how to edit and update State?
- Babel to translate JSX to JS
- React conditional re-rendered not triggered
- React Nuka slider where to put decorator ?
- Unable to map through and render data in JSX
- OnsenUI Navigator + React failed to navigate