Tuesday, 15 April 2014

html - ReactJS render string with non-breaking spaces -



html - ReactJS render string with non-breaking spaces -

i have props has string contain characters such &. contains spaces. want replace spaces  .

is there easy way can this? bear in mind cannot render using syntax:

<div dangerouslysetinnerhtml={{__html: myvalue}} />

because first have replace html entities markup. don't want have this, seems low level.

is there way can this?

instead of using &nbsp; html entity, can utilize unicode non-breaking space character:

<div>{myvalue.replace(/ /g, "\u00a0")}</div>

html reactjs

No comments:

Post a Comment