State laws can’t override the Constitution, and the states are bound by the 2nd Amendment too, so I don’t view those laws as valid, personally.
Whether one wishes to obey invalid laws or not, well that’s a matter for each of us to decide on their own I think.