Issue
I am using the   tag in jsx and it is not rendering the space. The following is a small snippet of my code.Please help.
var Reporting=React.createClass({
render: function(){
return(
<div style={divPositionReporting}>
<p>Pricing Reports</p>
<hr></hr>
Select Scenario:
<select>
<option></option>
</select>
<button type="button">Get Pricing Report</button>
<br/>
Select Takeout Scenario:
<select>
<option></option>
</select>
<button type="button">Get Pricing Report</button>
<br/>
</div>
);
},
});
Solution
See: JSX In Depth
Try:
Select Scenario:{'\u00A0'}
Or:
<div dangerouslySetInnerHTML={{__html: 'Select Scenario: '}} />
Or:
<div> </div>
Update
After seeing some of the comments, and trying it out. It has come to my attention that using html entites inside JSX works fine (unlike what is stated in the above jsx-gotchas reference [maybe it's outdated]).
So using something like: R&D
, would output: 'R&D'.
There is a weird behavior with
, which causes it to render differently, thus causing me to think it doesn't work:
<div>This works simply:- -</div>
<div>This works simply:- {'\u00A0'}-</div>
Produces:
This works simply:- -
This works simply:- -
Answered By - omerts
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.