3 ms·
I semi-agree with the point being made, but I don't like the solution. Spacer components isn't the solution, IMO, separating the reusable styles from one time s
by superfrank 7y ago
I semi-agree with the point being made, but I don't like the solution. Spacer components isn't the solution, IMO, separating the reusable styles from one time styles is.
so instead of:
<div class="link"/>
<div class="spacer"/>
<div class="link"/>
<div class="spacer"/>
<div class="link"/>
We should be doing:
<div class="link space-right"/>
<div class="link space-right"/>
<div class="link"/>
This allows the reusable styles to be reused and the spacing to be one off.
P.S. since I'm more of a react/styled-components kind of guy, this is how I would look to do it there
const Link = styled.div`
//... styles
`
const LinkWithSpacer = styled(Link)`
//... margin
`
<LinkWithSpacer />
<LinkWithSpacer />
<Link />