In reactjs & nbsp; does not show spaces

render () {

    return (
        <div>
        
        </div>
    );
}

render () {

    let text = "";
    return (
        <div>
        {text}
        </div>
    );
} 
Apr.01,2021

suggest inserting

 tag 


if written in this way, it will be rendered directly as a string.

even if you write

let text = '<span>333</span>';
    return (
        <div>
        {text}
        </div>
    );

will also render 333 together

the right thing to do is to use the dangerouslySetInnerHTML attribute, which officials say avoids cross-site scripting (XSS) attacks

let text = '';
    return (
        <div dangerouslySetInnerHTML={{__html: text }} />
    );
Menu