Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is it not recommended to use the styled API from styled-components for Extending? #1023

Open
jlison opened this issue Sep 2, 2020 · 0 comments

Comments

@jlison
Copy link

jlison commented Sep 2, 2020

image
Source: https://rebassjs.org/extending/

I was wondering why it is not recommended to use the styled API from styled-components for Extending?

Would be doing something like this a bad idea? Why? 🙂

import React from 'react';
import {Box, Text} from 'rebass/styled-components';
import styled from 'styled-components';

// Extending from styled
const Wrapper = styled(Box)`
    position: absolute;
    top: 10%;
`;

export default function ComponentName() {
    return (
        <Wrapper>
            <Text>Hello World</Text>
        </Wrapper>
    );
}

Note: normally, I would use an sx prop instead of using styled, but I wanted to keep the example simple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant