erikras / erikras/react-redux-universal-hot-example

How to propagate style changes down the view hierarchy

Open
#683 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

I really like a lot of the ideas this repo puts forth, particularly combining what would normally be two apps into one client/server mega-app. There are some things that baffle me though, the main one being how Sass and CSS styles are being appropriately applied down the view hierarchy.

This line in particular:

```
{ Object.keys(this.props.assets.styles).length === 0 ? : null }
```

inside `Html.js`, where the styling for my application view container is applied.

I did a `grep` on the rest of the project and there's no other instances of `dangerouslySetInnerHTML` so I can't see how the styling for other views is being included into the resulting html.

For example if I have:

```
import React, { Component } from 'react';
import { Link } from 'react-router';

export default class Header extends Component {
constructor() {
super();
this.state = { selectedLinkIndex: 0 };
}

render() {
const styles = require('./Header.scss');
return (
<div>
<div className={styles.header}>
<div className="busy-bee-icon"></div>
<div className="links">
<Link to="/">Promote</Link>
<Link to="/earn">Earn</Link>
<Link to="/vision">Vision</Link>
<Link to="/contact">Contact</Link>
</div>
</div>
</div>
);
}
}
```

where `Header.scss` is just `.header { font-size:50px }`

I would expect that result when I run the dev server (`npm run dev`).
I know I'm missing something, I'm just not sure what that is exactly. Any help would be greatly appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.