WASHINGTON (AP) — President Donald Trump loves to reminisce about his upset Wisconsin win in the 2016 election after Democrat Hillary Clinton took the state for granted.

He’s determined not to make the same mistake himself.

Wisconsin now counts as a pivotal state for the president’s re-election chances. But on the eve of his sixth visit to the state since taking office, Trump lashed out on Twitter at one of Wisconsin’s favorite sons, former House Speaker Paul Ryan over his unflattering comments in a new book.

“Paul Ryan, the failed V.P. candidate & former Speaker of the House, whose record of achievement was atrocious (except during my first two years as President), ultimately became a long running lame duck failure, leaving his Party in the lurch both as a fundraiser & leader,” Trump tweeted late Thursday night.

Paul Ryan, the failed V.P. candidate & former Speaker of the House, whose record of achievement was atrocious (except during my first two years as President), ultimately became a long running lame duck failure, leaving his Party in the lurch both as a fundraiser & leader…… — Donald J. Trump (@realDonaldTrump) July 12, 2019

Trump is making two Midwest stops Friday designed to warm up his 2020 campaign engine with fundraisers. He’ll also try to showcase the strong economy and push for Congress to pass the United States-Mexico-Canada Agreement, which could squarely impact Wisconsin.

He became the first Republican to win Wisconsin since Ronald Reagan in 1984, defeating Clinton by just 22,748 votes. Along with Michigan and Pennsylvania, the Rust Belt state was meant to be the Democrats’ safety net against Trump, but Clinton failed to visit the state even once during the general election campaign — a fact the president has mentioned time and time again.

“The Republicans haven’t won the great state of Wisconsin in decades,” Trump incongruously reminisced in Florida in March. “I went there a lot and in all fairness, her husband Bill, who’s a good politician — they didn’t listen to him. He said, ‘You better go to Wisconsin.'”

But the state remains starkly divided over the president and appears a toss-up again in 2020.

The latest Marquette University Law School poll in April found 52% of respondents disapproved of how Trump is handling his job, while 46% approved. The poll also found that 54% of respondents said they would definitely or probably vote for someone else in 2020, while 42% said they would definitely or probably vote to re-elect him.

In a troubling sign for Trump’s chances, Democrats swept every statewide office in the 2018 fall elections.

In the most notable victory for Democrats, Tony Evers defeated Republican Gov. Scott Walker after eight years in office. Republicans retained their tight grip on the state Legislature but they benefited from district boundaries they redrew to consolidate their power in 2011. And Republicans pushed back this past spring, when conservative Brian Hagedorn won election to the state Supreme Court.

The Trump campaign believes the state is winnable and plans an all-out blitz there again. But the president’s approval rating has slipped in several key Midwest battlegrounds.

Trump’s Twitter blast against one of the state’s highest-profile figures appeared to stem from anger over Ryan’s comments in a new book, “American Carnage” by Tim Alberta of Politico. In it, Ryan faults Trump for “knee-jerk reactions.”

Ryan did not seek reelection in 2018. Democrats took the House majority, a fact Trump noted in his tweets.

“He had the Majority & blew it away with his poor leadership and bad timing. Never knew how to go after the Dems like they go after us. Couldn’t get him out of Congress fast enough!”

READ MORE: Why Biden’s long foreign policy record could be a liability

Trump makes two stops in Milwaukee, one a fundraiser, and the other a visit to Derco Aerospace Inc., a subsidiary of aviation giant Lockheed Martin that provides parts, logistics and repair services to fixed-wing aircraft. White House officials said the president would use the visit to push for the USMCA, whose fate is uncertain in Congress.

Canada and Mexico are Wisconsin’s top two foreign export markets. Last year the state exported $31 million worth of products to Canada and $15.2 million worth of products to Mexico, according to census data.

Wisconsin imported $15.5 million worth of goods from Canada in 2018, behind only China. The state imported $9.3 million worth of goods from Mexico last year, the fourth highest amount of imports among the state’s foreign trade partners.

Kurt Bauer, president of Wisconsin Manufacturers and Commerce, the state’s largest business group, said it’s no coincidence that Trump decided to promote the USMCA in a swing state where the manufacturing sector contributes to nearly 20 percent of the state gross domestic product. Bauer said a new agreement with Mexico and Canada would cement markets with the state’s top two export targets.

“Having an agreement with those two countries is absolutely pivotal” for Wisconsin manufacturers, Bauer said.

Karen Gefvert, executive director of the Wisconsin Farm Bureau Federation, said the USMCA could help dairy farmers struggling with low milk prices.

The agreement allows the U.S. to increase the amount of dairy exports to Canada and removes retaliatory tariffs Mexico has placed on U.S. exports, Gefvert said, which should boost Wisconsin cheese exports by making them cheaper.

Derco Aerospace was accused of fraud in a 2014 lawsuit by the federal government that alleges it and two related companies schemed to overbill on a Navy contract for airplane maintenance. The case is pending in federal court in Milwaukee. The companies have denied wrongdoing.

After his visit to Wisconsin, Trump will travel to Ohio for a fundraiser in Cleveland. Democrats are criticizing the president for appearing with Brian Colleran, a nursing home magnate who was forced to pay $19.5 million by the Justice Department for his role in a Medicare fraud nursing home scheme.

Richmond reported from Madison, Wisconsin. Associated Press reporter Julie Carr Smyth in Cleveland contributed to this report.