It works like this:
Your resident state can tax ALL your income, regardless of where you earn it.
Other states with an income tax can tax you as a non-resident on your income from work done within their borders, unless they have tax reciprocity with your home state.
You do not have to file a tax return in a non-resident state unless your income in that state exceeds its filing threshold for non-residents. You can find filing threshold information online on the state's tax website.
If you have to pay income tax to a non-resident state, normally you'll be able to claim a credit on your home state tax return for those taxes. This prevents double-taxation.
**Answers are correct to the best of my ability but do not constitute tax or legal advice.