“The basic cause of this war from the Mexican side was the refusal to recognize the independence of Texas, which successfully revolted in 1836. In ten years as an independent republic Texas was recognized by the major nations of the world, most notably Britain and France, but not by Mexico.
From the borderland perspective, Mexico had forfeited its control. It withdrew most army units to engage in civil wars for political power, leaving the border region defenseless against repeated large-scale Indian raids. The Hispanics in Texas (“tejanos”) and New Mexico (“nuevo-mexicanos”) were affiliating more with the U.S. in terms of economy and security, and useless welcomed the American takeover.
Along the border
Delay (2007) and Reséndez (2004) explain the American need to suppress Indian raids originating from Mexican territory. During the 1830s and 1840s, northern Mexico experienced a terrifying increase in inter ethnic violence as Comanches, Kiowas, Apaches, and other Indians attacked Mexican settlements across nine states in northern Mexico. Raids claimed thousands of lives, ruined the ranching and mining industries, and forced most Hispanics to flee the border region. Just as importantly, the violence shaped how Americans and Mexicans came to view each other in advance of the war. US observers saw Indians driving Mexicans backward, with the government there uninterested and incapable of defending the territory it had seized from Spain. With the Mexican army being used primarily to wage political battles for control of the government, Hispanic residents of the affected areas despaired that their government would help them; they increasingly welcomed American intervention, which they correctly expected would end the Indian raids. Mexican politicians complained Washington was fomenting Indian raids in order to acquire territory.
Meanwhile in New Mexico, the economy and society were becoming integrated with the U.S. and nuevo-mexicanos were increasingly estranged from Mexico. Some Catholic priests tried to prevent full integration by restricting marriages between Protestant American men and Mexican Catholic women. By 1846 little fervor existed in New Mexico for resisting the American army. Consequently the Mexican army did not attempt to defend New Mexico or California. Some Hispanics after the war went to Mexico; (in Laredo the whole town); most of the tejanos, californios and nuevo-mexicanos preferred American rule; unfortunately some of them were murdered or, in many cases, dispossessed of their private properties. Disputes over land titles became endemic.   
In Mexico itself, Henderson (2007) emphasizes that Mexican agency in going to war reflected a profound sense of weakness. Mexico’s revolutionary experience had produced a virulent factionalism based on divisions of race, class, region and ideology. The success by Texas in 1836 only made it more clear that Mexico was too weak to populate, control and defend its northern territories, but that opinion was derided by Mexican politicians. Instead, they all denounced the policies of their rivals. The only common denominator was that Texas must be reconquered, even if that meant war with overwhelmingly superior U.S. military and economic power.” conservapedia.com