Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to change text color in react

  const [color, setColor] = useState('black');

  return (
	<div style={{textColor: color}}>
  		colored text
  		<button onClick={() => setColor('green')}> change to green </button>
    </div>
   )
 
PREVIOUS NEXT
Tagged: #change #text #color #react
ADD COMMENT
Topic
Name
8+7 =