Former President Barack Obama returns to the campaign trail on Thursday for the first time since he left the White House, venturing out to support Democrats in two governor’s races that could offer a clue about the national mood before next year’s midterm elections.

Obama, who has spoken at private party fundraisers but largely steered clear of electoral politics since leaving office in January, will make public appearances on behalf of Democratic candidates in Virginia and New Jersey- the only two states holding off-year elections for governor.

Those Nov. 7 contests will be closely watched to see if Democrats can turn the grass-roots resistance to Republican President Donald Trump into electoral wins after falling short earlier this year in four competitive special congressional elections.

The race in the political battleground of Virginia, in particular, is viewed as a potential bellwether. Opinion polls show a close contest between Democrat Ralph Northam, the state’s lieutenant governor, and Republican Ed Gillespie, a former Republican National Committee chairman who has been endorsed by Trump.

Obama carried Virginia in both 2008 and 2012, and Democrat Hillary Clinton won the state over Trump by 5 percentage points in 2016. Obama’s vice president, Joe Biden, appeared recently with Northam, while Vice President Mike Pence campaigned in southwest Virginia’s coal country for Gillespie.

In New Jersey, Obama will appear at a campaign event in Newark with Democrat Phil Murphy. Polls show Murphy has a comfortable lead on Republican opponent Kim Guadagno, the state’s lieutenant governor, who is hindered by the unpopularity in the state of Trump and Republican Gov. Chris Christie.

Since leaving the White House, Obama has frequently criticized Trump and Republicans in written statements for efforts to gut his signature health care law and roll back his immigration and environmental policies. The campaign appearances will give him a forum to take on Trump directly if he chooses.

The state contests in Virginia and New Jersey, and a special election in December for a U.S. Senate seat in Alabama, are a preview of next year’s congressional elections, when all 435 seats in the House of Representatives and one-third of the Senate’s 100 seats will be up for grabs. Republicans currently control both chambers.