DEV Community

Discussion on: Convert HTML Inline Styles to a Style Object for React Components

Collapse
 
samselfridge profile image
samselfridge

Thanks for this! just had to convert a html template to react and this was a timesaver!

Might be good to tweak it so it allows whitespace at the end. Most strings would always be: style=" color: red; " with white space after the last ; because of auto-formatting and I had to keep deleting it. Looking back, probably would have been faster to tweak the code myself, but I thought it was only a few that had that issue, not most of them.

Collapse
 
qausim profile image
Yusuff, Olawumi Qauzeem

I'm glad it helped. Thanks for the suggestion, I'll work on it.