Skip to content
Advertisement

How to map data that we get from database to UI?

I have a Redux action function called getAllJob which is supposed to get all jobs informations (title and description) from database:

JavaScript

Now i need to map this response.data.data to UI to be rendered so i get a list of jobs with titles and descriptions for each one from database. For that, i tried the below code but it doesn’t work:

JavaScript

Kindly can you help me achieve my goal?

Update:

adding console.log(response), shows this:

JavaScript

Advertisement

Answer

Try setting you response as a state variable which you can then loop through.

JavaScript

And then for mapping:

JavaScript

Note: If this doesn’t work, provide us the logged response from the api call.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement