139
rated 0 times
[
146]
[
7]
/ answers: 1 / hits: 89428
/ 10 Years ago, wed, october 22, 2014, 12:00:00
In React JSX it does not appear to be possible to do something like this:
render: function() {
return (
<{this.props.component.slug} className='text'>
{this.props.component.value}
</{this.props.component.slug}>
);
}
I get a parse error: Unexpected token {. Is this not something React
can handle?
I'm designing this component so that under the hood, the values stored in this.props.component.slug
will contain valid HTML elements (h1, p, etc.). Is there any way to make this work?
More From » reactjs