Giter Site home page Giter Site logo

Comments (4)

trusktr avatar trusktr commented on September 28, 2024

Seems like I'm doing things correctly, because if I modify my component from using aphrodite-jss,

import {StyleSheet, css} from 'aphrodite-jss'
import {Component} from 'react'

export default
class Foo extends Component {
  render() {
    return <div className={css(classes.footer)}>
      <div className={css(classes.logoAndCopyright)} />
    </div>
  }
}

const classes = StyleSheet.create({
  footer: {
    // ...

    '& $logoAndCopyright': {
      // ...
    },
  },

  logoAndCopyright: {},
})

to using plain JSS (from react-jss), then it works great:

import {jss} from 'react-jss'
import {Component} from 'react'

export default
class Foo extends Component {
  render() {
    return <div className={classes.footer}>
      <div className={classes.logoAndCopyright} />
    </div>
  }
}

const {classes} = jss.createStyleSheet({
  footer: {
    // ...

    '& $logoAndCopyright': {
      // ...
    },
  },

  logoAndCopyright: {},
}).attach()

So seems something isn't working in aphrodite-jss.

from aphrodite-jss.

HenriBeck avatar HenriBeck commented on September 28, 2024

I think the problem is the order of evaluation. The rules are lazily attached, which means the rules are only attached once css is being called with them. The footer rule is being attached before the logoAndCopyright rule, which results in the warning.

I don't know if we can fix this. You can just call css(classes.logoAndCopyright) before which should fix your problem.

from aphrodite-jss.

trusktr avatar trusktr commented on September 28, 2024

Hmmm, that may be a strange caveat. It'd be nice to fix it. Well I've switched to react-jss because I was able to get that to work with SSR in the other thread, and to use aphrodite-jss I would have to solve the same problem again for aphrodite-jss.

from aphrodite-jss.

kuzmenko-tgn avatar kuzmenko-tgn commented on September 28, 2024

As I see - it's old issue - but maybe somebody gonna looking for solution as I - to resolve this I moved style Initialization inside of component body

from aphrodite-jss.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.