Vijaya Patil
Vijaya Patil

Reputation: 11

React js- background color of the selected item

I have react js code: status.js

import * as React from 'react';
import './status.css';

const Status = () => {
  const [value, setValue] = React.useState('');
  const [selected, setSelected] = React.useState('');

  const handleChange = (event) => {
    setValue(event.target.value);
  };
  

  return (
    <div>
      <label>
        <select value={value} onChange={handleChange}>
          <option value="inProgress" >In progress</option>
          <option value="yettoStart">Yet to start</option>
          <option value="closed">Closed</option>
        </select>
      </label>
    </div>
  );
};

export default Status;

I want to change the background color of the dropdown button o green when I select In progress.

What should I add to the above code?

Upvotes: 1

Views: 202

Answers (0)

Related Questions