score:2
Accepted answer
NOTE: I would have commented but I do not have enough reputation.
The Issue with the code you provided is that you do not return anything from your mapping function.
{comments.comments_images.map((child,i) =>{
<div key={i}>
<img src={child.s3_url} className={classes.magetty} />
</div>
})}
Instead
{comments.comments_images.map((child,i) =>{
return (
<div key={i}>
<img src={child.s3_url} className={classes.magetty} />
</div>
)
})}
Also If do not loop over all your comments first you might have issues also. Make sure you map over the comments
array then you map again over the comments_images
. Because your current implementation of the map is comments.comments_images
while comments
is an Array.
score:2
The map function is not returning anything.
Try the below code...
<Grid className={classes.gridList}>
{comments.comments_images.map((child, i) => (
<div key={i}>
<img src={child.s3_url} className={classes.magetty} />
</div>
))}
</Grid>
or
<Grid className={classes.gridList}>
{comments.comments_images.map((child, i) => {
return <div key={i}>
<img src={child.s3_url} className={classes.magetty} />
</div>
})}
</Grid>
Source: stackoverflow.com
Related Query
- How to show the image links in an array of an object with map function in React?
- how to compare id of html element inside of a map function with the id of an object outside of the map function
- how do i update state in react for updating the value of an object inside an array using array.map function
- How can use my object like a array using with map function
- React - How to show skeleton placeholders until Array map function ended
- React - map function sets the input values only with the last item in the array
- How to add an image in the first react component and ignore in rest of the components using map function
- How do the map function that return an object with modified keys? (JS, React.js)
- What is the best way to define "KEY" in React when creating a list with map function from an array which containing no unique ID or fields?
- How to update value of a key in object in an array with the new value in React useState in TypeScript
- How to get the index of an array map , out of the map function in React
- How to manipulate the DOM inside of map function using onChange event on one of the checkboxes with react hooks
- How can I set a specific position to array elements with the map function and a given index?
- Convert object to array with Lodash _.map and use map function in React
- How to map through an Array of object with the same data on some object and get it displayed once and also get other properties
- How to show in a list, visible markers in the google map with React
- React Native: How do I apply a custom function to an array of objects and return the modified array in Javascript with an additional field?
- How to pass both image file and object with values from React and retrieve it on the Node.js (express) server?
- How to create an image background fade when mapping an array of images with React
- How do I show the Google passport oAuth consent screen in the react frontend, not with express views template
- How to find object in array and show it in React component?
- React js useState hook. How to update state of a json object with an a array in it when a checkbox is clicked
- How to map inside map function and show the data in Reactjs
- how to pass the current item to the function so that i can remove it from array in react component?
- How to use if statement in array map function with next.js
- How to select random object from array with React Hooks?
- How to push an object into an array with React Hooks
- How to add items into specific Id using the react array map method
- React : how to pass and array from inside a Function to the return (JSX)
- How to structure a component using React Hooks with an object that uses the DOM directly? (such as OpenLayers)?)
More Query from same tag
- How to check email overlap using Axios get and post for SignUp with React?
- React Js: update one item from array of object
- Onclick listener - value of string type
- Get from api react with useState, useEffect
- react admin pagination is not working expected
- Get all objects in an endpoint using axios if there is a pagination involved.
- Setting initial state in Redux sub-reducers
- Cannot get a path reference in Firebase Storage with getDownloadURL() - React Native
- react doesn't rerender component when props changed
- Dynamic pagination with Scroll in ReactJs
- Why does my React App have a syntax error for index.pack.js?
- Call Function(that render component) in async Function
- Switch the language in React without using external libraries
- Can you pass parameters to a React hook that takes in no parameters?
- React Redux - Conditional selector
- Setting React state in .map function without overwriting state
- Why does react hook form errors object temporarily empty?
- How to handle dynamic routes with HashRouter in React?
- How to remove the root of the tree when rendering in react.js
- React with GraphQL: TypeError: parse is not a function
- Redux Form: Input stays with 'touched: false'
- <TextInput keyboardType="numeric"/> is not working in react native
- How to render three elements of each time? React
- Divide code into smaller components ruins state
- Does order in which you wrap component with connect and withRouter matter
- Why doesnt my dispatch for axios POST work?
- How to prompt radio button based on usestate
- Passing a property aquired asynchronously
- Update local state as well as redux store value simultaneously?
- Can't rename response in redux action