3 ms·
Call me old school if you like, but the cleaner solution in my eyes are to create well-defined CSS classes for such margins and use them in my designs. <di
by neya 7y ago
Call me old school if you like, but the cleaner solution in my eyes are to create well-defined CSS classes for such margins and use them in my designs.
<div class="margin-10">..</div>
<div class="margin-20">..</div>
<div class="margin-30">..</div>
is MUCH cleaner than:
<div space={3}>..</div>
<div space={4}>..</div>
The difference being, first of all, I don't need to dig into the source to see what `space` does. Next, appearance layer is tied to CSS and the JS takes care of the rest of the structure of the component.
- hjanssen 7y agoWhat would stop you from calling the space attribute just "margin" in your react component? For me, the second approach does look much cleaner and if I really want to see what you are doing, I also have to open your CSS Stylesheet. I guess it does come down to preference and familiarity.
- simplify 7y agoThis is basically tailwindcss, and is an excellent approach when done well.