Retirement tax questions

Thanks for your post - I would like to ask a follow-up question.

I am exactly in the situation, I live in NJ and work for NY state. 

What would happen if after I retire, end up moving to a different state where both 457(b) contributions and gains (hopefully) are taxed? Will that state somehow know that my contribution was taxed already by NJ and give me credit for that? 

 

Thanks,