As President Donald Trump continues to spew lies about “election fraud” and attack democratic institutions, he is handing China a huge Christmas gift.

Trump touts his hard-line tack toward Beijing as a historic policy shift. He warned during the election campaign that if Joe Biden won, China “would own the United States.

On the contrary, President-elect Biden grasps something Trump never understood. The president’s chaotic China policy — and his failed trade deal — ignored the essential elements for success: convincing Chinese leaders that America’s democratic system is not crumbling, and uniting with other democracies to beat China at its own game.

The Trump-driven effort to discredit the election has only strengthened Chinese leader Xi Jinping’s message to his people — that their authoritarian system and high-tech achievements are poised to overtake the United States.

Chinese state-controlled media are filled with disdainful commentary about the election — and the still soaring U.S. deaths from COVID-19, after Beijing stamped out the pandemic there.

» READ MORE: A peaceful transfer of power: we didn't know how normal that was until it was almost gone. | Trudy Rubin

“Hopeless America,” proclaimed a columnist at the official Xinhua News Agency. " U.S. democracy now a joke,” wrote the Ta Kung Pao broadsheet. “Time to wake up from blind faith in the Western system,” said the state-run China Education News last week. “Vicious partisan fighting has worsened ... and a severe social crisis is brewing.” And on and on.

On a visit to China a year ago, I heard a growing confidence from think tank experts about Chinese prospects of overtaking a politically paralyzed America. But America’s continued internal upheaval appears to have accelerated that nationalist pride amongst the Chinese public and the country’s leaders — to a degree that may inspire risky overconfidence.

And Trump’s trade deal certainly didn’t dissuade Xi Jinping from an increasingly aggressive policy overseas.

Trump’s instincts about unfair Chinese trade practices were correct. But as his former national security adviser John Bolton has written, the president’s trade policy was incoherent, driven not by strategy but by his own political needs.

Rather than insist on structural changes that would force China to play fair in trade and technology, Trump focused on sweet-talking Xi Jinping to buy more soybeans, in order to help the president win farm states in the election. Meantime, in October, America’s trade deficit with China was as large as last year’s. In the holiday season, imports from China are soaring.

And the cost of Trump’s trade tariffs against China have been borne not by Beijing, as the president claims, but by U.S. consumers and taxpayers.

So Xi Jinping had Trump’s number, as he continues to strengthen China’s armed forces and make military gains in the region at America’s expense.

Which brings us to President-elect Biden, for whom China policy will be the biggest foreign-policy challenge. Here is what he has recognized, something that Trump never understood:

An America First policy will never be enough to make China reconsider its mercantilist trade policies, such as stealing intellectual property, illegal subsidies, and forced “technology transfers” from U.S. companies. “The most effective way to meet that challenge is to build a united front of U.S. allies and partners to confront China’s abusive behaviors,” Biden wrote in the March issue of Foreign Affairs. Unlike Trump, Biden will work to renew alliances with America’s democratic partners in Europe and Asia, from day one.

Moreover, to compete effectively with China, America must have a functioning political system, with bipartisan cooperation in Congress. Anyone who travels to China can see the country is pulling ahead of the United States in infrastructure and internet connectivity. It is prepared to overtake us in critical areas of technology that will determine who leads the world in the future.

To attack our democratic institutions — as Trump is doing with his unending lies to his base about election fraud — is the equivalent of a military assault on our homeland. It plays to Chinese perceptions that our democracy is failing.

» READ MORE: How Biden ally Chris Coons hopes to cure congressional paralysis. | Trudy Rubin

Ditto for the president’s efforts to prevent bipartisan cooperation on addressing issues of inequality and race that divide us.

Without bipartisanship, America cannot make the advances in infrastructure and key technologies to prevent China from overtaking us. It is time for a red-blue accord on a U.S. industrial policy — call it a Sputnik moment.

Biden gets this. “I will make investment in research and development a cornerstone of my presidency, so that the United States is leading the charge in innovation,” he wrote in Foreign Affairs “There is no reason we should be falling behind China or anyone else when it comes to clean energy, quantum computing, artificial intelligence, 5G, high-speed rail, or the race to end cancer as we know it.”

No reason at all, if patriotism finally displaces GOP cowardice on Capitol Hill and proves that American democracy can renew itself. All it takes is a few upright Republican senators to lead the way.