Components & JSX13 / 14
Up next

Conditional attributes

function SaveButton({ busy }: { busy: boolean }) {
  // an attribute value can be any expression
  return (
    <button disabled={busy} className={busy ? "is-busy" : "idle"}>
      Save
    </button>
  );
}

export default SaveButton;
What you're solving

compute an attribute value from state or props