score:5
Accepted answer
as pointed out by azium my data is an object and not an array like my results were expecting.
to get the "game" array inside the "games" field i set the state as the following:
this.setstate({data: data.data.games.game});
to get the other fields i simply created a new state and passed it through a prop i.e. modified_date:
this.state.date = data.data.games.modified_date
the warning: each child in an array or iterator should have a unique "key" prop.
was fixed by adding a "key" property inside the .map method:
render: function() {
var gamedate = this.props.data.map(function(data) {
return (
<h1 key={data.location} >{data.location} </h1>
);
});
Source: stackoverflow.com
Related Query
- ReactJS this props is not a function
- How to map inside map function and show the data in Reactjs
- Uncaught TypeError: map is not a function In Reactjs with Firebase
- Data from Parent to child using props in ReactJs is not working properly
- Data passed as props is not shown in django and reactjs
- React why is this simple array map function not returning anything?
- map is not a function in reactJS
- Map not a function error when i'm trying to pass props to a child
- Map function not working while passing props into React component (TypeScript, React and Next.js)
- Why does moving the array map of props outside the render function not work in React?
- map function does not return anything in reactjs
- How do I render json data in the javascript function using map - Reactjs
- Map is not a function when passing data to populate child component
- this.state array in reactjs map is not a function
- ReactJS Component function call this and props undefined
- ReactJS map function not working on a lightbox gallery
- Reactjs map function does not render the component
- Map function not able to implement in reactJS app
- Trying to map data through props to React Bootstrap Accordion - data not displaying?
- Reactjs - Building form from data set, FormElement not returning to the render function
- ReactJS - trouble looping through data array props with map
- reactjs - this is not a function error on upgrade
- is map function is not working or fetched data have some problem
- Reactjs filter then map function isn't display images? Is it not re-rendering?
- diaplays same data in react js, if condition not working or working but map function takes all value without sorting
- Images are not displaying with <li> tag in map function for array object in Reactjs
- reactjs - Function not working inside a map function
- Why does adding/removing curly braces in this arrow function cause the text to not display for a ReactJS component?
- why my map function is not working to display API data on browser?
- Is this method a proper way to avoid .map is not a function in ReactJS
More Query from same tag
- Component doesn't re-render after I set state
- React - show/hide element on click
- next.js @reduxjs/toolkit useSelector return undefined
- React Typescript how to stop axios/fetch calls from making multiple calls at one time
- TypeError: Object(...) is not a function when using useHistory() hooks
- React Formik : how to use custom function onChange and onConfirmChange for request input
- Reacstrap Form Reset input value MERN stack
- React - Autocomplete calling API
- React why my clearInterval cannot stop setInterval?
- How to make API call (CRUD) on React JS
- Necessary adjustments when running react app on amplify server instead of local machine
- React-Router: Nested Routes and Parent re-render
- Sum of an array from json data
- how to redirect to a page after successful login: ReactJS?
- How do I collect the check box name and send the request?
- ERROR: React Hook useEffect has a missing dependency: 'dispatch'. Either include it or remove the dependency array
- ReactJS 17.0.2 seems to call function again when putting value into DOM
- 'React' is defined but never used
- React multiple criteria filtering
- How to semantically mark up multilevel checkbox and radio groups?
- Can I send several events on action in flux?
- I passed a function from parent to child, implemented it onClick on the child. Getting Error: this.props.function() is not a function
- req.query from backend turns out to be json on React front end after deployed to heroku, how to fix it?
- How to send an email after validating form inputs in reactJS?
- New property value not being rendered
- React Javascript displaying/decoding unicode characters
- Hidden input doesn't trigger React's onChange event
- Toasty does not autoclose or manual close after hook list
- mern - updated values are null in data
- HOC which passes all props