You can have a license in one state and live in another, but where your license is must be your primary residence.
For example you could have 2 homes with them being in different states and you can keep your driver's license and vehicle registration in your primary resident state.
So if you live in the state where your license is in, but you go to the other home in the other state and live in the other state such as over winter or for 3 to 6 months and then return to your other state for your primary residence, then you can have your license in the other state and temporarily live in the other state.
But if you take up permanent residence in the new state, then you cannot legally have a driver's license in the other state where you don't have any residence.
All states require that you get a new driver's license and vehicle registration in that state once you take up residence, which is usually within 30 days.
You can temporarily use an out of state driver's license and vehicle registration, but if you moved permanently to the new state then you must apply for a new driver's license and registration in the new state of residence.
This is to ensure that you have a driver's license and vehicle registration that accurately reflects your legal address and complies with legal requirements and insurance.
Your auto insurance also has to be changed to the new state when transferring your vehicle registration to the new state.
To transfer your driver's license to the new state you will need your current out of state driver's license, proof of your new residency like a mortgage statement, lease agreement, utility bill and other forms of identification like your birth certificate or social security card.