You may think that following the Revolutionary War, the United States wasn’t involved in another war with a foreign nation until the War of 1812—but that’s not entirely true. America was involved in two unofficial wars during this time, one of which was the Quasi-War with France, from 1798 to 1800.
During the American Revolution, the United States had signed a treaty of alliance with France, but after the war, in 1794, the Americans signed a trade treaty with Britain, who by then was at war with France. France felt that the Americans’ treaty with Britain violated their treaty with the French, and to add insult to injury, the United States refused to pay back its debt to France, arguing that the money was owed to the French monarchy, not the new French Republic. So in 1796 France’s government decided to allow privateers to capture American merchant ships, which they did in vast quantities, seizing over 300 ships in the first year.
In 1797, President John Adams sent envoys to try to work things out with the French, but to no avail, and the attempt at diplomacy ended in the infamous XYZ Affair. Since the American navy was nonexistent at this point—and since America was also having trouble with the Barbary States at the time—the government got started on commissioning or converting about 30 various navy ships, and in July 1798 the U.S. withdrew from the treaty with France.
The Quasi-War was fought entirely at sea, and the new American navy started going head to head with the French privateers it found, mostly in the Caribbean, and did well for itself. The two most famous engagements involved the USS Constellation, which emerged victorious from both battles against French ships. Although they were working separately, by 1800 the Americans and British had made a big dent in the French privateers, and that, combined with a change in French government, resulted in reconciliation between America and France. The two countries signed an agreement to annul their previous treaty and restore trade between them.