I am trying to merge these two styled-components into one.
const CustomInput = styled.input`
width: 150px;
height: 100%;
`;
const CustomTextarea = styled.textarea`
width: 150px;
height: 100%;
`;
Mixins with Styled Components Essentially, a mixin is a block of styles that can be seen like a component in the sense that: A set of styles are written as a standalone block. Those styles can be imported and used many times. The set can support props to dynamically alter values throughout lifecycles.
styled-components support server-side rendering with stylesheet rehydration which allows you to use styled-components with React DOM's every time you render an app on the server. In order to do that in Next. js, you need to follow some setups in its docs: Install Babel plugins.
Use string interpolation:
const sharedCSS = css`
width: 150px;
height: 100%;
`
const CustomInput = styled.Input`
${sharedCSS}
`
const CustomTextarea = styled.textarea`
${sharedCSS}
`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With