In 2021, I sold stocks at a loss in California before moving to another state by end of 2021. I still own a rental property in California that generates $10000 in income

On my California return can I deduct the allowed $3000 loss from stock against the $10000 income. 
I don't deduct it from another state as I live in a state that has no state tax