Question from the React (legacy) test

Write a React component that displays the hexadecimal CSS color code of certain colors.

Medium

Here is a component that is supposed to display the hexadecimal CSS color code of certain colors.

class CSSColors extends React.Component{
  constructor(props){
    super(props);
    this.state={colorCode: ''};
    this.changeColor= this.changeColor.bind(this);
  }
  
  changeColor(evt){
    this.setState({colorCode: evt.target.value});
  }
  
  render(){
    return(
     <div>
        The color code
       <select onChange={this.changeColor}>
         <option value="#ff0000">Red</option>
         <option value="#00ff00">Green</option>
         <option value="#0000ff">Blue</option>
       </select>
        is {this.state.colorCode}
     </div>
    );
  }
}

Check the statements that are true:

Author: Victor SabatierStatus: PublishedQuestion passed 1422 times
Edit
0
Community Evaluations
developer avatar
François
13/10/2021
Les affirmations ne sont pas très claires. (n'apparaissant pas, je ne peux pas être plus précis)