I have a textarea. I want to show my text real time when user is typing.
but new lines and free spaces is ignored.
I'm using html-react-parser
library.
import parse from 'html-react-parser';
return (
<div className="card-postal-main-picture-wrapper">
<div className="card-postal-main-picture">
<img
src="/img/card-postal-picture.png"
alt=""
className="main-picture"
/>
<div className="card-postal-text" style={{ textAlign }}>
{textes.map(item => {
return (<span style={{ fontFamily: newFontName }}>
{item.text?parse(item.text):""}</span>)
})}
</div>
</div>
</div>
);
};
` after `span` (and wrap them in a `Fragment`). – brc-dd Oct 30 '21 at 12:55
` and if you want extra space you can use ` ` – Omri Attiya Oct 30 '21 at 12:58
` text on the screen instead of rendering the tag. One needs to use `dangerouslySetInnerHTML` prop for that, or better a parser library to convert html string to JSX element. – brc-dd Oct 30 '21 at 13:03