West Virginia, which seceded from Virginia (which itself had seceded from the Union) during the Civil War, became its own state in June 1863. It and Nevada were the only states admitted during the War, although Kansas became a state in early 1861, just a couple months before the hostilities began. The state has shifted several times between supporting the Democratic or Republican party in its history, with each shift tending to last a generation or more. Primarily Republican from 1900 until the Great Depression, the state was then reliably Democratic, with few exceptions through Bill Clinton's 2nd election in 1996. Since then, the state has become solidly Republican, with that party winning by an increasing margin in each election from 2000 through 2016. In the most recent election, Donald Trump's populist message deeply resonated with voters in a state that is struggling economically. Trump defeated Hillary Clinton by over 42%, his 2nd largest margin of victory, behind only Wyoming.
The state has been growing more slowly than the country for more than 50 years; its electoral vote total has dropped from 8 in 1960 to 5 today. If trends continue, it will lose an additional electoral vote after the 2020 presidential election.