Much has been said about trying to avoid reinventing the wheel and reusing other people’s code where you can. This makes a lot of sense when you consider the quality components and projects in the wild today. However, this may not always be the best choice.
Learning to know when it makes sense to write your own solution can be tricky. It is easy to swing too far in either direction. Defaulting to writing your own solution every time can be just as dangerous as always trying to fit square pegs into round holes.
Take time to research and experiment with existing solutions to see if you can use them first before you set off to write your own code. Once you’ve done this you can feel confident in deciding to head down the path of reinventing the wheel.