I know that JSX can be very misleading because it looks like strings, and it doesnโt, so the term โstringโ is in question, even if we donโt actually manipulate strings.
Here is a sample code (wrong, obviously):
let line = <Line key={line.client_id} line={line}/>; if(line.created_at) { return <div className="date-line"><strong>{line.created_at}</strong></div> + line; } else { return chat_line; }
I have a string, and I want to "concatenate" some divs in front of it under certain conditions. What will be the correct syntax? I tried brackets, brackets, plus a sign ... None of them seem to work ...
thanks
concatenation reactjs jsx
Sephy
source share