0

I'm using React library and I want to insert a text with <br> text inside a html element.

var FinancialOverviewRow = React.createClass({
    render: function() {
    return (
            <tr>
                {
                    this.props.data.map(function(val, index) {
                        jsx = <div>{val}</div>;
                        return (<td className={fields[index].classname} key={key}>
                                    {jsx}
                        </td>);
                    })
                }
            </tr>
        );
    }
});

But here the val is a text which sometimes includes <br> . How can I format it somehow that I really use this tag as a HTML tag ? All the solutions I've seen somehow use jQuery which I don't.

Arian
  • 7,397
  • 21
  • 89
  • 177
  • if all you're trying to do is break the line. `\n` at the end of your string should work ex `var string = "Hello\nWorld";` – mwilson May 07 '15 at 00:24
  • Please use the search before you ask a new question: http://stackoverflow.com/search?q=%5Breactjs%5D+html+string – Felix Kling May 07 '15 at 01:05
  • @mwilson no it doesn't work, because it gets rendered into DOM element and `\n` means nothing in HTML. – Arian May 07 '15 at 04:32

0 Answers0