Was the earned income from State B work location part of your living state of residency during 2017? If you moved to a new state during 2017, you'll normally file a part-year return for each state you lived in during 2017, assuming the state(s) collect income tax.
If income was earned from another state but still living at the home state of residency, you'll fill a nonresident state return.
Below is the answer from TurboTax FAQ can help you determine which state part-year or nonresident return to file. https://ttlc.intuit.com/replies/3302342