Republicans have suffered a string of losses in off-cycle elections since Trump took office, with voters frustrated over the cost of living and his immigration policies.