How To Return Multiple Image Elements In React
i am trying to find a way to return multiple images from a function. In the example here: https://codesandbox.io/s/gifted-jennings-fcghy you can see that the first function can ret
Solution 1:
How to return multiple image elements in React?
By returning an array of elements. For instance:
return [
<imgsrc="a.png"/>,
<imgsrc="b.png"/>,
<imgsrc="c.png"/>,
];
That works as the return value of a reusable function, and also as the return value of a functional component or a class component's render
.
Post a Comment for "How To Return Multiple Image Elements In React"