您可以像这样添加条件类:
<input className={`bg-white ${isInvaid ? 'text-red' : 'text-black'} h-40px text-lg hover:border-blue-400 border-solid border-b-2 w-[87%]`}/>