Was the Mexican-American War popular? Surprisingly not, on both sides. For Mexico, it was Quixotic, plus the US was offering to buy the land it needed to move its territory west, and Mexico actually wanted to sell that land. For the US, a war with Mexico was a needless military exercise for lands that Mexico was going to sell anyway. But the USA acted too provocatively by annexing Texas and pro-war forces inside Mexico went forward with a declaration of war. About 20% of Mexico’s citizens lived north of the present border in 1847, when the war broke out. When news of war reached California, John C. Fremont lead the Bear Flag revolt in Sonoma, California, taking over a Mexican army garrison based there and they raised the bear flag and declared independence from Mexico. The California Gold Rush and statehood soon followed. Mexicans living north of the border were supposed to have their citizenship and property rights converted directly to US but that didn’t happen. Not honoring the Treaty of Guadalupe-Hildalgo lends political justification for illegal immigration from a Mexican point of view.
The Mexican-American War was held under great protest on both sides. Support in both the US and Mexico for a war was anything but solid. Abolitionists and Whigs saw military aggression in the south as spreading slavery and ignoring expansion of free states toward the Pacific Northwest. Indeed, slavery was envisioned by Texans and other southerners as being spread to California, even Cuba. Those pushes got calmed down in the years after the Mexican War. As for Mexico, they were offered 2x the price for all that land the US forced Mexico to cede after the war before the war, plus there would have been no war. Support for declaring war on the US was weak inside Mexico as well, so weak that Santa Ana, that General, seized power and declared war as a dictator, mounting a failed campaign to get Texas back (it’s a long march from Mexico City To Texas!) while the US countered by taking over every major Mexican port city by ship, plus some interior cities via a short march inland from those ports. At that point the war was over and Mexico was paralyzed to conduct any further action.