dmikester1
dmikester12y ago

✅ – ✅ – dmikester1 – 04-11 Apr 27

I have what I think should be a simple problem, but nothing seems to be working. I am simply trying to get a line break in my table cell, but I am constructing the string with Javascript(React).
8 Replies
dmikester1
dmikester1OP2y ago
Here is my code:
let message = l.message;
if (l.error) {
message += `/r/nError: ${l.error}`;
}

if (l.data) {
message += `/r/nData: ${l.data}`;
}

return (
<tr key={i} className={l.level}>
<td>
{fromToday ? (
time
) : (
<ReactTimeAgo date={time} />
)}
</td>
<td>{l.level}</td>
<td>{l.fullName}</td>
<td>{l.filename}</td>
<td>{l.route}</td>
<td>{l.lineNum}</td>
<td>{message}</td>
...
let message = l.message;
if (l.error) {
message += `/r/nError: ${l.error}`;
}

if (l.data) {
message += `/r/nData: ${l.data}`;
}

return (
<tr key={i} className={l.level}>
<td>
{fromToday ? (
time
) : (
<ReactTimeAgo date={time} />
)}
</td>
<td>{l.level}</td>
<td>{l.fullName}</td>
<td>{l.filename}</td>
<td>{l.route}</td>
<td>{l.lineNum}</td>
<td>{message}</td>
...
Trying to add line breaks at the beginning of 'Error' and 'Data'. I have tried all variations of /r/n, \r\n, /n, \n, <br />. Also tried putting an actual line break in the template literal as I read that would work somewhere.
vcarl
vcarl2y ago
Might need to mess with the styling in your table cells, but I'm not sure exactly with what. Or maybe split up into <p> tags
dmikester1
dmikester1OP2y ago
I tried the p tags and unfortunately React is just printing out the tags
dmikester1
dmikester1OP2y ago
dmikester1
dmikester1OP2y ago
Maybe I'll have to ask in the React forum aw, i think i found it now, haven't had to do this in so long, i forgot how to do it!
dmikester1
dmikester1OP2y ago
Stack Overflow
ReactJS convert HTML string to JSX
I'm having trouble dealing with facebook's ReactJS. Whenever I do ajax and want to display an html data, ReactJS displays it as text. (See figure below) The data is displayed through the success
reactibot
reactibot2y ago
This question has an answer! Thank you for helping 😄 If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1100997616038322227
reactibot
reactibot2y ago
This question has an answer! Thank you for helping 😄 If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1100997616038322227 This thread hasn’t had any activity in 36 hours, so it’s now locked. Threads are closed automatically after 36 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1100997616038322227