Re:Utopia, a visual design tool for React, with code as the ...
by rattray on Tuesday June 15, 2021 @10:37PM
(#27524264)
What I really want is a way to sync back changes made in the inspector to my css-in-js code. Does Chrome offer hooks that a library could use to accomplish this?
[ Parent
| on HN ]
Re:Utopia, a visual design tool for React, with code as the ...
by maltenuhn on Wednesday June 16, 2021 @08:11AM
(#27527592)
If you're referring to the Chrome devtools inspector - unfortunately, that's a no. To start with, no such hooks are available. Additionally, the truly hard bit is figuring out what code the resulting HTML maps to, especially when there's lists, conditional content, and nested components involved.
Re:Utopia, a visual design tool for React, with code as the ...
by rattray on Wednesday June 16, 2021 @10:36PM
(#27535663)
Eh, I don't think that's necessarily the truly hard bit, at least for common cases with a library design that works. With something like `useStyles()` from material-ui, you get a fairly unique className, and coupled with a build tool that injects the file/line/col location into the className, should be able to map directly back.