styled-forward-as
v0.1.0 react-component
forwardAs
Forwarding for the as
prop in styled-components a la React.forwardRef
.
import styled from 'styled-components';
import forwardAs from 'styled-forward-as';
const Button = styled.button`
/* styles */
`;
const PrefixButton = forwardAs(({ prefix, children, ...rest }, as) => (
<Button as={as} {...rest}>{prefix}{children}</Button>
))`
/* styles */
`;
npm i [email protected]
Metadata
- MIT
- Whatever
- [email protected]
- released 7/1/2019