I'm working inside a stateless function controller in React. I'm trying to do a console.log inside a map that is inside a return statement. This works:
{options.map(o => (
{console.log(o)}
))}
And this works:
return (
<>
//more html/jsx code
{console.log("test")}
//more html/jsx code
</>
)
But how to log inside a map that is inside a return statement? like so:
return (
//more html/jsx code
{options.map(o => (
<>
{console.log(o)} //doesn't compile
console.log(o) //doesn't work -> written in DOM
</>
))}
//more html/jsx code
)
Anyone have an idea if this is possibly at all. I find many answers articles/questions where they do 1 of the 2. Or in a map or in a return statement. Can't seem to find an answer that is both in a return statement and a map. I, ofcourse, only use console.log for testing purposes