How did Texas become the Republic of Texas?

Texas became the Republic of Texas after it won it's independence from Mexico in 1836. Texas became a state after it's annexation to the United States in 1845.