AFAIK after approval for the H1B, you usually have go through consular services in your home country to get the H1B stamped and to come back on it.
https://www.wsmimmigration.com/immigration-resources/faqs/fi...
F1 is the same. You can have an expired visa but maintain legal student status in the US because visa is for entry only.