Mike Haslam
2 min readJan 26, 2021

--

Create a Tags UI Component in React and Styled Components

Try it here https://bef94.csb.app/

I need to make a React component that enables users to create tags on their profile.

So I went looking to see if anyone had already created such a component. I did find this component on CodePen by Fabio here is a link to his pen

https://lnkd.in/gE-rDmT

I decided instead of Willy Nilly cutting and pasting into my project, I would instead refactor to use Functional Components managing state with Hooks and styling with Styled Components.

I have found that refactoring other people’s code really forces you to understand how the code actually works instead of just following along.

Here is a Code Sandbox of my refactor have a look let me know what you think or if you have any optimization suggestions.

Thank you for taking the time to read my article, if you’re looking for more posts like this, you can find me on LinkedIn, Dev, Medium, Facebook, Twitter, Instagram

If you enjoy reading stories like this and want to support me as a writer, Consider buying me a Coffee ☕️

--

--