I have saved HEX color in useState.
The problem is that the RGB color is displayed in the resulting HTML.
For example: I put the same use state in the DIV and also as the font color in the inline style.
import React, { useState } from "react";
const Module = () => {
const [color, setColor] = useState("#bada55");
return <div style={{ color: `${color}` }}>{color}</div>;
};
export default Module;
The result is like this. But why? I only need to display the color in HEX format at all times. How to do it?
<div style="color: rgb(186, 218, 85);">#bada55</div>
Thanks for any advice!