Skip to content
Advertisement

Tag: api

TypeError: this.state.data.map in reactjs

Hii All , I know this question is asked many times but I cant figure it out I’am getting the error. I have checked for all the questions similar to this but haven’t found specific solution if I use another link i.e, “https://jsonplaceholder.typicode.com/users” this one the code works fine . Answer The returned data from https://reqres.in/api/users?page=2 is not an array,

Callback error when calling endpoint function

I’ve received an Node.js api documented with swagger for debbuging. I also have to make some features in it, but I’m having some trouble when calling, in the code, the functions executed when you hit an specific endpoint. To make my self clear: Works fine from Swagger UI when I only give it the argument of the ID required in

How to properly implement useQueries in react-query?

I’m using react-query to make two separate queries in the same React component. I originally tried using two useQuery hooks: Here’s the content of useData, which is imported from another file: fetchData is a function that queries an AWS DDB table. I’m happy to post that function, but I’m currently excluding it for brevity. Rendering Component results in this error:

How to Display plain text of api result ( noob question )

I am completely new to api. I want to display the plain text response of the output of this: https://vurl.com/api.php?url=https://google.com to my webpage html but it’s not working. My code: Thanks Answer Not really sure why you’re mixing javascript with your php code. Nevertheless, this is the approach you should follow:

API: Ajax post in Laravel – 403 (Forbidden)

I’m getting 403 forbidden during ajax call. This is happen only if the ajax is on app.js. If I remove from app.js and put to index.blade.php, is working perfectly. How can I make it working also on my app.js? I’ve searched a lot, and found I needed to add this $.ajaxSetup({ headers: { ‘X-CSRF-TOKEN’: $(‘meta[name=”csrf-token”]’).attr(‘content’) } }); before the ajax,

API accessing certain values from data with JavaScript

I have the following API Data: And here is my code with a fake API code: All I would like to do is get the changesPercentage and display it on my webpage with HTML and CSS. I will have various data from different companies, so a versatile solution would be very helpful. Answer You’re trying to get changesPercentage from percent,

How to assign fetched data to React state

I trying to fetch data of an object (in this example from https://api.themoviedb.org/3/movie/459151?api_key=f13446aa3541ebd88cf65b91f6932c5b) and I’m trying to assign it to state movie. However, when I console it out, it has value undefined (actually, it is consoled out twice, firstly with default values of state and secondly as undefined). How to solve it? Thanks Answer As it seems in the API

Advertisement