Rhapsody has been upgraded to styled-components v5. This upgrade brings significant performance improvements for styled-components as well as many DX improvements when writing styled-components.
Changes in v5 include:
- Significantly faster performance mounting and updating component styles
- New feature: the
asprop allows you to swap out the underlying element in a styled-component, e.g.<StyledLink as={ThirdPartyComponent}>Click me</StyledLink> - New feature: Transient props allow you to pass props to the styled-component without passing them to the underlying DOM node, e.g.
<StyledInput type="text" $size="large" /> createGlobalStyleis used to add global styles instead ofinjectGlobal.injectGlobalhas been removed.- Use
refwhen passing a ref to a styled-component instead of the oldinnerRefprop.innerRefhas been removed. - If you use a function with the
.attrssyntax, the function needs to be at the top level, not nested at each props. See the.attrsdocs for more information. - The
.extendsyntax has been removed. For some time, it has been possible to extend styled-components usingstyled(SomeComponent)and that is now the only way to do so.
See the styled-components documentation for more information on these changes and other styled-component features.