2018 California's 21st congressional district election

The 2018 election for California's 21st congressional district was held on November 6, 2018, during the 2018 elections to the U.S. House of Representatives to determine who would represent California's 21st congressional district. The district, centered in the San Joaquin Valley, represents parts of Fresno County, Kern County, Kings County and Tulare County. It was represented by the incumbent, Republican David Valadao, since 2013.

Democrat TJ Cox, after dropping out of a competitive primary for the seat in California's 10th congressional district, chose to run against Valadao. Despite the district leaning Democratic and national polling suggesting a Democratic wave election, many election analysts considered Valadao likely to win. On election night, Valadao held an 8-point lead, the AP and other news networks called the race for Valadao, and Cox conceded. However, mail-in and absentee ballots, which constituted about sixty percent of all ballots cast in the race, started arriving in the days and weeks following election day and swung heavily toward Cox. On November 26, Cox took the lead, retaining it until all ballots had been counted; Valadao conceded the race on December 6.

Background
California's 21st congressional district is located in Central California; it is a primarily agricultural district, and almost three quarters of its population is Hispanic. Politically, it leans five points more Democratic than the rest of the nation according to the Cook Partisan Voting Index, and 44% of voters are registered Democrats, compared to only 27% registered Republicans.

Despite its preference for Democrats, Republican David Valadao won each of his three previous elections by double digits. In 2016, while Democratic presidential candidate Hillary Clinton won the district by sixteen percentage points, Valadao won reelection by thirteen. Valadao's support has been attributed to his moderate viewpoints; support for and focus on local issues, such as water policy for the routinely drought-plagued district; and early opposition to Donald Trump.

Primary
Valadao, the incumbent, declared his candidacy for the election on February 23, 2017. As a Republican-held district Clinton won in 2016, the Democratic Congressional Campaign Committee included this district in its initial list of 2018 targets.

Emilio Huerta, Valadao's challenger in 2016, originally intended to challenge Valadao again in the 2018 election. However, dealing with poor fundraising figures since his filing, Huerta dropped out of the race a week before the filing deadline, leaving Democrats without a challenger in the district. TJ Cox, a businessman from Fresno county originally running in the 2018 election for the 10th district, elected to drop out of that crowded primary in favor of the 21st district after Huerta dropped out.

The candidates were the only two to file by the deadline. The primary, held on June 5, 2018, resulted in Valadao and Cox advancing to the general with 63% and 37% of the vote respectively; no write-in candidates received votes.

Polling and pollster ratings
Following the primary, Dave Wasserman of the Cook Political Report rated the district "Likely Republican". This aligned with similar ratings issued by Inside Elections and Sabato's Crystal Ball. Aside from Sabato's Crystal Ball, which moved CA21 to Lean R, these ratings stayed the same through election day. FiveThirtyEight's rolling election forecast featured a "Lite" model which initially favored Cox based solely on national and local polls, including generic ballot national polls which showed Democrats significantly outperforming Republicans; however, its "Classic" and "Deluxe" forecasts, which took into account non-poll factors like candidate favorability, fundraising, and past performance, gave Valadao an edge. Furthermore, following the only poll in the district showing a lead for Valadao, the "Lite" model moved in his favor.

While most competitive Democrats were significantly outraising and outspending Republicans in the 2018 cycle, Valadao saw slightly greater fundraising totals than Cox in their election. The only poll in the district, conducted September 20–24 by SurveyUSA, showed Valadao with an 11-point lead in the race, and president Trump with a 48% approval rating in the district, with 43% disapproving.

{| class="wikitable" ! Poll source ! Date(s) administered ! Sample size ! Margin of error ! style="width:75px;"| David Valadao ! style="width:75px;"| TJ Cox ! Undecided
 * - valign=bottom
 * SurveyUSA
 * align=center| September 20–24, 2018
 * align=center| 555
 * align=center| ± 5.4%
 * align=center| 50%
 * align=center| 39%
 * align=center| 11%
 * align=center| 11%

Campaign
Just one debate was held, on October 25, 2018. Cox attacked Valadao on health care, immigration, and support of president Trump; he brought up an oft-repeated claim in his campaign that Valadao voted with Trump 99 percent of the time, and criticized Valadao's votes for repealing and replace the Affordable Care Act and the 2017 Republican tax cuts. Valadao defended his votes, disputing Cox's claims about his Trump support and pitching himself as a "hometown public servant", and focusing on local issues like water rights.

During the campaign, Valadao attacked Cox over his residency, since Cox owns a residence near Washington, D.C., and does not live in the 21st district. The Cox campaign reported that Cox bought another home in Bethesda, Maryland, while his wife studied public health policy at Johns Hopkins University, but also reported that Cox's family have since returned to nearby Fresno.

The Migrant Caravan, which president Trump vilified in a tweet a week before the debate in an attempt to incite fear and make immigration a greater focal point for the midterms, came up in the debate as well. Cox argued that the migrants should go through the legal process of applying for asylum, while Valadao argued that most of the migrants were not fleeing violence at home but just pursuing opportunities in the U.S.

Results
California elections are conducted with the use of both polls and mail-in ballots, where the latter are accepted any time so long as they are post-marked by election day. California's 21st is a primarily rural Congressional District, leading many to vote by mail rather than at a polling place that may be quite far away. Furthermore, those ballots may take days or even weeks to reach their destination in these rural areas. California did not certify its November 6 election results until December 14, with votes from the 21st district being received and counted through most of this period.

Votes began being counted moments after polls closed on election day. The final election day vote tally represented most of the votes issued at polling locations. Late on election night, Valadao had a 12.6 percentage point lead with over 48,000 votes counted. This led the Associated Press, Politico, and other election analysts to call the race for Valadao, as the prospect of that lead being reversed seemed severely improbable. After all precincts reported their polling vote results, Valadao's lead shrunk to 8%, but was still seen as insurmountable with the given margins and projected remaining mail-in ballots.

As mail-in votes were received and counted, however, the result began to change dramatically. By the next Sunday, Valadao's lead was down to 2.2 percent, with 83,008 ballots counted and a number of mail-ins remaining. At this point, it started to become clear the race could go either way. On November 21, Valadao's lead shrunk to below 400 votes, with thousands left to be counted, and some analysts had retracted their calls. Finally, on November 26, Cox took the lead. For this reason, the AP retracted its call, as did NBC. AP received some criticism from other election analysts for delaying its retraction until Cox took the lead. Nate Silver of FiveThirtyEight, in particular, labeled AP's delay as an attempt to avoid retracting its call in the case that Valadao managed to hold on, despite it being clear he could end up losing well before the call.

Cox retained his lead through the last of the ballot counting, eventually winning with a margin of 0.8 percent. Valadao conceded on December 6, making California's 21st Congressional District the 40th flip to the Democrats of the 2018 midterms, and the second to last election to be decided (behind the election for North Carolina's 9th Congressional District, in which widespread vote manipulation was discovered, leading to a 2019 special election).

Results by county
Results by county. Blue represents counties won by Cox. Red represents counties won by Valadao.