Great question!
I also have asked myself the same question many times! And it is true that work experience has a major impact on building up your skills.
E.g. if I want to be a back-end developer and at the beginning of my career and I get to work in a new project. The team is great, feedback is constructive, I get to see and understand various trade-offs in the design of the architecture & choosing different frameworks/technologies, seniors developers act as mentors, etc. Working in such an environment no doubt accelerates your growth.
But what if that is not the experience you are getting at your workplace. I think in such cases the important thing is to identify where you want to focus. Do you want to be a back-end, front-end, UI designer, UI Developer, etc? If you want to be a front-end dev, what does is it mean to be a front-end dev?
For me, I wasn't clear which path I wanted to take at the beginning of my career. I kept learning whatever came in my path and whichever tech was popular. It was really haphazard. Personally, if I had to do that all over again I would choose the area I want to grow in and focus on getting my basics right. E.g. for back-end it could be algorithms, OS basics, etc and for front-end, it could be getting the fundamentals of JavaScript right, CSS basics like box-model, etc.
Once you have the direction then understand the concepts and make sure you implement it in a side-project or at work. Also, I cannot emphasize the importance of participating in tech discussions or events (online or physically) enough.
I hope it helps! Thank you for asking!