score:3
Accepted answer
you're using await
with then()
. you should switch to one. if you use await, assign the result to a variable. you should also be passing back the data of the response and not the response itself.
const response = await axios.post(...)
callback(response.data)
if you want to use then
, then it's:
axios.post(...)
.then(respone => callback(response.data))
Source: stackoverflow.com
Related Query
- axios.post().then() not passing resolved data to callback function
- req.params not passing from React frontend to serverless function on Axios post request
- passing data from child to parent component - react - via callback function
- Sending state for an Axios POST and data not showing in req.body
- useState not updating data when passing from parent function component using ref
- How to send data as string and not json on axios post
- Axios post does not send data
- Map is not a function when passing data to populate child component
- Axios callback function not working in put method
- React axios post request does not send the data
- Passing secondary data to my second callback function
- TypeError: language.map is not a function when getting data using axios
- How do I see why Axios POST request is not sending payload data to Heroku Backend?
- pages.map is not a function in gatsby nodejs using axios to fetch data
- Then and Catch not running on successful Axios Post request on Backend
- Axios post not passing body parameters
- Passing a function as a callback to a React state created with hooks did not reflect new value of variable
- POST request with Axios not sending data to my server
- React .map function not passing data to useState
- Axios POST does not recognize the data being passed in from react
- Passing a function to React Component and then calling it causes "Uncaught TypeError: x is not a function"
- React typeerror in axios callback TypeError: this.setState is not a function
- React : Callback value received in parent not passing the latest value in another child as prop | Function component
- Function not defined while passing child data to parent
- Uncaught (in promise) TypeError: data.map is not a function (React using axios getting data from ASP.NET API)
- React.js - How do I pass data from a div to a function with axios POST method?
- Why does ASP.NET Core 6 MVC Route handler not accept data from axios post request?
- not able to receive axios data sent via post method at my backend
- Component not remounting after passing axios request data
- Api call to post data not working with either fetch or axios
More Query from same tag
- Why does the Material-UI Select does not display any option?
- Using useMemo instead of React.memo syntax issue
- how can fix refresh problem in react router
- RTK Query query not refetching after mutation
- Creating custom variants with Material-UI
- Django backend, React frontend and CSRF Post
- how to redirect to homepage after successful login in ReactJS?
- Cannot read property in React js
- Problem with date (react-datepicker) when i paste new date in datepicker input
- fetch data is providing some [assets] and [objects]. How can I de-structure these in the following code in order to list them out?
- Haze about 'setState' in React official doc
- Reach Click handler from parent to child component is not working
- Add new tab in Storybook story
- React Links - "requested URL was not found on this server" after being deployed
- Table header only aligned with first column
- How to pass data from one react component to other react component when clicking on <Link tag
- Avoid looping through map if single item change
- NextJS dynamic import issue
- How to display 3 rows of data in react?
- Pick<S, K> type with dynamic/computed keys
- pass URI.parseQuery value from default funtion to a user defined funtion
- Create-react-app don't run even just after create it
- Settings states before render - Can't call setState on a component that is not yet mounted
- Mock multiple fetch calls with state updates in ReactJS
- How to correct displaying value in chart?
- Update same variable from two different components
- Using multiple context in a class component
- what is the use of the keyMirror node package part of facebook's library?
- Render a nested array of objects in react
- How to display data on top of others instead of simultaneously with React checkboxes?