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

[universal-redux] How to apply global styles? #10

Closed
0xsven opened this issue Nov 8, 2016 · 2 comments
Closed

[universal-redux] How to apply global styles? #10

0xsven opened this issue Nov 8, 2016 · 2 comments

Comments

@0xsven
Copy link
Contributor

0xsven commented Nov 8, 2016

Awesome boilerplate!

Until today I was using the master branch to work on components. Like in your examples I was using injectGlobal from styled-components to add webfonts, root font size and some base styles for html and body elements.

Today I decided to try the server side rendering branch. I realised that injectGlobal runs on page load. That causes a small glitch in the UI because the browser first displays the page without said styles and then injects them only after first render.

Using a styles.css solves that issue. I was wondering if you have a better solution to that?

@diegohaz
Copy link
Owner

diegohaz commented Nov 9, 2016

Thank you for the feedback, @0xsven.

There's an open issue on styled-components repo for that: styled-components/styled-components#124 (comment). While this isn't solved, the styles.css is the way to go.

@diegohaz
Copy link
Owner

@0xsven It was my fault. I put it inside componentDidMount, which doesn't run on server. If you put injectGlobal on componentWillMount it works.

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

No branches or pull requests

2 participants