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

Warning: Unknown prop jsx on <style> tag (version 2.3.0) #1879

Closed
paulbrie opened this issue May 4, 2017 · 4 comments
Closed

Warning: Unknown prop jsx on <style> tag (version 2.3.0) #1879

paulbrie opened this issue May 4, 2017 · 4 comments

Comments

@paulbrie
Copy link

paulbrie commented May 4, 2017

I've updated to 2.3.0. When loading from the server I get this warning:

...Warning: Unknown prop jsx on <style> tag. Remove this prop from the element. ...

My code:

import { styles } from '../constants'

const FooterStyle = () => (
  <style jsx>
    {`
    
    footer {
      background-color: ${styles.mainColor2};
      text-align: center;
    }

    li {
      color: white
    }
    
  `}
  </style>
)

module.exports = FooterStyle

If if delete the jsx attribute and then put it back the warning does not appear anymore which makes me think that the issue is on the server-side only.

Thanks,
Paul

@arunoda
Copy link
Contributor

arunoda commented May 4, 2017

That's weird.
We all use style jsx in our apps.
Could you send us a sample repo for this?

Also check the .babelrc file which is used in your app.
You can see it when you run npm run dev.

@paulbrie
Copy link
Author

paulbrie commented May 5, 2017

Hi @arunoda! I put the code here: https://github.com/cluj-javascripters/jsheroes.io
I'm not using any .babelrc file.

@arunoda
Copy link
Contributor

arunoda commented May 5, 2017

Hey @paulbrie we don't support styling as you did it.
You need to use it inside the component like this:

<div style={{ minHeight: 800, backgroundColor: styles.mainColor5 }}>
    <Container>
      <h1>JavaScript <br /> International Conference</h1>
      <style jsx>{`
        h1 {
          font-size: 55px;
          font-family: Arial;
        }
      `}</style>
    </Container>
  </div>

As you can see here, it only gets affected to h1 in this component only.
See this lesson for more info: https://learnnextjs.com/basics/styling-components

@paulbrie
Copy link
Author

paulbrie commented May 6, 2017

Thanks, got it.

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants