Democrats are coming off a crushing defeat in last year’s presidential election. In addition to losing the White House and making only modest gains in the House and Senate, the party lost seats at the state and local level. Republicans hold 33 governorships, and full control of 25 state legislatures.

And yet, Democrats are feeling optimistic about their chances in the 2018 midterm elections, thanks to the GOP’s early struggle to enact its agenda in Congress, President Donald Trump’s low approval ratings, and the investigations into Russian meddling in the 2016 election.

“There’s definitely been more enthusiasm, people at events, more grassroots involvement, and people involved,” said Stephen Webber, the chairman of the Missouri Democratic State Committee.

But while Democratic strategists and party leaders are hoping to make gains next year, they face a number of formidable challenges, especially in the Senate.

There are 34 Senate races in 2018, including the special election for the Alabama seat formerly held by Attorney General Jeff Sessions. Of those, 23 are held by Democrats, and another two are held by independent senators who caucus with the Democrats. 10 Democrats are up for reelection in states that Trump won last year.

READ MORE: At D.C. forum, Democrats look towards 2020, but can’t get past Trump

Since the election, liberal groups like Swing Left and Indivisible have sprung up across the country to protest the Trump administration’s agenda and back Democrats running for office in states like Missouri, where Democratic Sen. Claire McCaskill could face a tough reelection battle next year.

The grassroots activism is partly why Democrats are eyeing 2018 as a potential opportunity to pick up seats. The party is also hoping to capitalize on a GOP policy agenda — including health care and tax reform — that many voters on the left oppose.

“Republicans are pursuing an agenda that’s incredibly toxic with the midterm voters,” said Democratic Senatorial Campaign Committee spokesman David Bergstein.

Several special elections for open congressional seats this year have provided some insight into how the 2018 midterms will play out. Democrat Jon Ossoff finished first in a crowded race for a moderate Georgia district, forcing a runoff that’s taking place later this month between Ossoff and Republican Karen Handel in what has turned into the most expensive U.S. House race ever. Both sides had spent $30 million on the race through early May, breaking the previous record for a House race of $29.6 million spent on a Florida seat in 2012.

A Democrat finished a close second in deep red Kansas, and Rob Quist came within six points of beating his Republican opponent in last month’s race for Montana’s at-large congressional seat, in a state that Trump won by 20 points in 2016.

But while the special elections were closer than expected, suggesting a surge of enthusiasm on the left, Republicans still won two of the three races. (The third race, in Georgia, will be decided in a runoff election next week).

While the special elections were closer than expected, suggesting a surge of enthusiasm on the left, Republicans still won all three races.

The GOP has struggled to recruit top-tier candidates. Republican Montana Attorney General Tim Fox was widely considered to have the best shot at unseating Tester, but he appears to no longer be interested in the race. In Indiana, GOP Rep. Susan Brooks was seen as the party’s top candidate against Donnelly, but she has said she’s not interested in running as well.

But there is still plenty of time for Republicans to recruit candidates ahead of the midterms. And Republicans argued there were early signs that the GOP would be in better shape next year than Democrats suggest.

“Voters can see Republicans are getting results in job creation, growing the economy, and keeping our families safe,” said Bob Salera, a spokesman for the National Republican Senatorial Committee. “That will be the difference when they head to the polls.”

Montana’s close race, which included a physical confrontation near the end between a reporter and the eventual winner, Republican Greg Gianforte, should give anyone planning to run against Sen. Jon Tester (D-Mont.) pause, said Chris Meagher, the Montana Democrats’ senior communications advisor.

Tester is one of the 11 Democratic senators up for reelection in states that Trump won, but Meagher said national politics won’t dictate the state’s senate race.

“Montanan voters vote for the individual person, not the party line,” Meagher said. “They know Jon and they like Jon.”

Democrats made similar arguments in other red states where the party is defending seats in 2018. Trump won Missouri by 19 points, nearly doubling Republican presidential nominee Mitt Romney’s margin of victory there in 2012. Still, Webber said Missourians are nervous about the Trump administration’s policies on health care, public education, and agriculture.

“A lot of communities are dependent on agriculture exports, and one of our biggest customers is Mexico,” Webber said. “There’s a real concern that Trump’s blustering will lead Mexico to purchase corn from Brazil instead of Missouri.”

Like McCaskill and Tester, Sen. Joe Donnelly, D-Ind., faces reelection next year in a state that overwhelmingly voted for Trump. Trump won Indiana by 19 points, part of the wave of support across the Midwest that helped him win the White House.

READ MORE: Is socialism in the United States having a moment?

Just a month after the election, Trump flew to Indianapolis and promised to keep a Carrier Corp. factory from moving to Mexico. Trump announced a deal with Carrier to save about 800 of the factory’s jobs — and touted the agreement as proof that he was delivering on his campaign promise to create jobs and grow the economy even before he took office.

But in May, United Technologies, which owns Carrier, announced that the factory was shutting down, with hundreds expected to lose their jobs.

“Trump is nothing else but a showman,” said Jeff Harris, an Indiana-based Democratic strategist. “He can make promises but there is little follow up.”

Still, Harris said Trump’s economic message remained popular in Indiana and elsewhere across the country, including among moderate voters who could help decide close races in 2018.

“It will be an uphill climb for Democrats in red states,” Harris said. “Incumbents can reach out to moderates and open-minded Republicans. It all comes down to personality.”

Correction: An earlier version of this story misstated the number of Senate Democrats up for reelection in 2018. It is 25, including two independent senators who caucus with the Democrats, not 38.