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

how to target classname in aphrodite #402

Open
moezbenrebah opened this issue Oct 19, 2022 · 2 comments
Open

how to target classname in aphrodite #402

moezbenrebah opened this issue Oct 19, 2022 · 2 comments

Comments

@moezbenrebah
Copy link

Hi there, I'm trying to use aphrodite to style my react web app, but I didn't figure out how to target classname within StyleSheet.create({}). I'm using this current example, so how can I target these classnames:

<>
  <component className="Foo">
    <childComponent className="Bar">
  </component>
</>
@moezbenrebah moezbenrebah changed the title how target classname in aphrodite how to target classname in aphrodite Oct 19, 2022
@lmahistre
Copy link

Hi,
You have to use the 'css' function for this.

const styles = StyleSheet.create({
  Foo : {
    // ...some style
  },
  Bar : {
    // ...other style
  },
})

const Component = () => <>
  <component className={css(styles.Foo)}>
    <childComponent className={css(styles.Bar)}>
  </component>
</>

@moezbenrebah
Copy link
Author

Hi, You have to use the 'css' function for this.

const styles = StyleSheet.create({
  Foo : {
    // ...some style
  },
  Bar : {
    // ...other style
  },
})

const Component = () => <>
  <component className={css(styles.Foo)}>
    <childComponent className={css(styles.Bar)}>
  </component>
</>

You mean within react file.

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

2 participants