DEV Community

Mike Haslam
Mike Haslam

Posted on

# Create a Tags UI Component in React With Styled Components

Alt Text

Try it here

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
Codepen

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.

My Code Sandbox

#UI
#ReactComponents
#ReactComponents
#StyledComponents

Top comments (0)