Primarily you should come up with a solution, rather than search for a solution, but junior developers tend to do it the other way around or leave the first part altogether.
Copy/pasting from Stack Overflow is just so quick and easy, isn’t it? You scroll down to the first answer, it has a green check, many upvotes, the code works, case closed. Do you really think trusting a green check to put something into your codebase is called software developing? Maybe. Do you think Linus Torvalds does it this way? Highly doubt it. As long as the code is working it doesn’t matter where it came from. Or does it?
When you’re using Stack Overflow or code snippets from some blog post, you’re one or many steps away from the primary source of information, it being official documentation. How many steps away depends on the code snippet author. If they used official docs, you’re one step away. If they used a Stack Overflow answer which used official docs, you’re two steps away and so on. It’s like playing telephone, but you don’t know how many people lie in between and how much noise they make. It’s, therefore, safer to not play this game and start at step 0.
But who wants to open official documentation and read that wall of text. Well, people who want to get to the bottom of things. They’ll also go under the hood and debug source code of whatever library they’re using, trying really hard to figure out how things work. The outcome of such an approach is very few surprises when running the code because the code behaves how you think it should behave. When you’re reading source code of some amazing framework, in a way you’re hanging out with some pretty talented people. You’re touching their work. And you thought you had to be cool to hang out with cool people.
Back to that copy/pasting thing. You don’t know who wrote that code and what their agenda is, but you can and should trust yourself, so go with that first, always. After a while, people will notice your confidence and quite possibly start calling you senior developer.