Answer the question
In order to leave comments, you need to log in
`
How to add the same styles to two elements at once in styled-components?
export const PrevBtn = styled.div`
svg {
display: flex;
color: ${(props) => props.theme.colors.primary};
font-size: 50px;
cursor: pointer;
}
`
export const NextBtn = styled.div`
svg {
display: flex;
color: ${(props) => props.theme.colors.primary};
font-size: 50px;
cursor: pointer;
}
`
Answer the question
In order to leave comments, you need to log in
Your styles are declared as constants, so you can just use one of them or make it common:
const commonStyles = styled.div`
svg {
display: flex;
color: ${(props) => props.theme.colors.primary};
font-size: 50px;
cursor: pointer;
}
`
export const PrevBtn = commonStyles
export const NextBtn = commonStyles
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question