How to add active class to button with React?

To add active class to button with React, we set the className of the button.

For instance, we write

<div>
  {buttons.map((name, index) => {
    return (
      <input
        type="button"
        className={active === name ? "active" : ""}
        value={name}
        onClick={() => someFunct(name)}
        key={name}
      />
    );
  })}
</div>

to add buttons by adding inputs with type button.

Then we apply the active class if the active value equals name.

When do something with name when we click the button