Skip to content

Commit

Permalink
docs: improve examples section
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeysova committed Aug 8, 2019
1 parent 791dedf commit 8130ede
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Expand Up @@ -22,6 +22,7 @@ Use as component:
```js
// index.js
import React from 'react'
import ReactDOM from 'react-dom'
import { Normalize } from 'styled-normalize'

import { App } from './app'
Expand All @@ -32,6 +33,8 @@ const Root = () => (
<App />
</React.Fragment>
)

ReactDOM.render(<Root />, document.querySelector('#root'))
```

Also you can use [`createGlobalStyle`](https://www.styled-components.com/docs/api#createglobalstyle) API:
Expand All @@ -44,7 +47,7 @@ import { normalize } from 'styled-normalize'
export const GlobalStyle = createGlobalStyle`
${normalize}
// You can continue writing global styles
// You can continue writing global styles here
body {
padding: 0;
background-color: black;
Expand All @@ -58,12 +61,14 @@ import ReactDOM from 'react-dom'
import { GlobalStyle } from './styles'
import { App } from './app'

ReactDOM.render((
const Root = () => (
<React.Fragment>
<GlobalStyle />
<App />
</React.Fragment>
), document.querySelector('#root'))
)

ReactDOM.render(<Root />, document.querySelector('#root'))
```

You can also use named imports:
Expand Down

0 comments on commit 8130ede

Please sign in to comment.