That's a good question. I wish I had a better answer, haha :)
One thing I found super useful was to blog. I know blogs maybe seem a bit dated these days, but to explain something in my own words forced me to understand it better. I think sites like Hashnode are also great because folks can share their posts and discuss them in an arena that's supportive and has things like community guidelines and codes of conduct.
Going to local meetups can also be great. Not necessarily for finding a mentor (though that may happen) but more so just to build a sense of community. I know that if you're learning to code by yourself it can feel pretty isolating, so having a place where you can go maybe once a month to check in with folks can really keep you motivated.