I am trying to map through an array and return jsx however I'm using Typescript and so .map only returns functions (not jsx). How can I loop through the array and return some jsx for each array element in React?
I already have
return (<div>{array.map(this.function)}</div>) so I'm returning a function on each array element but I would like to return both jsx and a function from map. I've tried this {array.map(() => {return this.function && <p>text</p>})} but it's just returning either the jsx or the function.
What I want to achieve: When I map through the array, I want to run a function on each array element as well as return a paragraph <p></p> on each element so that I can display some text next to the output of the function.
Any help would be appreciated!
array.map((...args) => this.function(...args)())I would like to display some jsx next to the rendered functionthis.function? It is also important to make sure you are using HOC correctly to get a function using this..map? I tried using&&but it's returning either the jsx or the function? @KrzysztofKrzeszewski