Reputation: 75
I have JSX code like this:
<Item cate="capital" parm={"11"+{<span>.55</span>}} small="Feb" />
I think there's nothing wrong but my browser keeps telling me "Unexpected token".
how can I fix it?
Upvotes: 0
Views: 561
Reputation:
you can use ES6 template, try this:
<Item cate="capital" parm={`11${<span>.55</span>}`} small="Feb" />
Upvotes: 1
Reputation: 2197
Proper way of doing it: Pass it to your item component:
<Item cate="capital" parm={<span>.55</span>}
small="Feb"
addToParm="11" />
And just use it in your Item component:
<div>
{this.props.addToParm}
{this.props.parm}
</div>
Upvotes: 0