How to set color to text in React JS

后端 未结 4 1507
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 09:15

I just want to change color of text using style in tag

How can I do that?


4条回答
  •  遇见更好的自我
    2021-02-19 09:43

    You can use inline-style like:

    const element = 

    Hello world

    or

    const hStyle = { color: 'red' };
    const element = 

    Hello world

    For more info:

    • Inline Styles

    Demo:

    const rootElement = document.getElementById('root');
    const element = 

    Hello world

    ; ReactDOM.render(element, rootElement);
    
    
    

提交回复
热议问题