const [color, setColor] = useState('black'); return ( <div style={{textColor: color}}> colored text <button onClick={() => setColor('green')}> change to green </button> </div> )