 The Republic of Texas existed as a separate country from 1836 to 1845.Texas was annexed as a state into the United States in 1845, and the Mexican–American War followed from 1846–1848.The war was concluded by the Treaty of Guadalupe Hidalgo, in which the U.S. received the lands contentiously claimed from Mexico by Texas (including the Oklahoma Panhandle), as well as lands west of the Rio Grande to the Pacific Ocean (the Mexican Cession).