It’s a bit more messy than that in California even. Non competes are not forbidden, just generally unenforceable due to some other labor laws. So a lot of companies will still to this day have employees sign non-competes, and threaten them with legal action if they violate them.
They’d almost certainly lose, depending on circumstances, but the threat is enough to have a pretty strong chilling effect.