Skip to content

Commit 054c601

Browse files
committed
docs(README): improve docs and remove duplication
1 parent 360ca47 commit 054c601

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

README.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,7 @@ $ npm install --save react-flag-icon-css
3131

3232
## Using in a `create-react-app` app
3333

34-
Apps bootstrapped with [`create-react-app`](https://github.com/facebookincubator/create-react-app) support this module out of the box, remember to set `useCssModules` to `false` (unfortunately `create-react-app` does not currently support Css modules).
35-
36-
```js
37-
// @flow
38-
import * as React from 'react';
39-
import FlagIconFactory from 'react-flag-icon-css'
40-
41-
// Please only use `FlagIconFactory` one time in your application, there is no
42-
// need to use it multiple times (it would slow down your app). You may place the
43-
// line below in a `FlagIcon.js` file in your 'components' directory, then
44-
// write `export default FlagIcon` after it and import it everywhere in your app.
45-
const FlagIcon = FlagIconFactory(React, { useCssModules: false })
46-
// ...
47-
```
34+
Apps bootstrapped with [`create-react-app`](https://github.com/facebookincubator/create-react-app) support this module out of the box, just follow the [Basic Usage](#basic-usage) example and remember to set `useCssModules` to `false` (unfortunately `create-react-app` [does not currently](https://github.com/facebookincubator/create-react-app/pull/2285) support Css modules).
4835

4936
## Prerequisites for *custom* apps
5037

@@ -64,18 +51,18 @@ $ npm install --save-dev ...
6451

6552
## Basic usage
6653

67-
Import `FlagIconFactory` from `react-flag-icon-css`, it accepts the `React` module as the first argument and creates the `FlagIcon` component. *This approach ensures that `FlagIcon` uses your app's `React` instance, avoiding issues such as two versions of `React` being loaded at the same time.*
54+
Import `FlagIconFactory` from `react-flag-icon-css`, it accepts the `React` module as the first argument and creates the `FlagIcon` component (remove the *@flow* comment if you don't use `Flow`, it does not have any effect). *This approach ensures that `FlagIcon` uses your app's `React` instance, avoiding issues such as two versions of `React` being loaded at the same time.*
6855

6956
```js
70-
/* your-app/your-components/FlagIcon.js */
57+
/* your-app/your-components-directory/FlagIcon.js */
7158
// @flow
7259
import * as React from 'react'
7360
import FlagIconFactory from 'react-flag-icon-css'
7461

7562
// Please only use `FlagIconFactory` one time in your application, there is no
7663
// need to use it multiple times (it would slow down your app). You may place the
7764
// line below in a `FlagIcon.js` file in your 'components' directory, then
78-
// write `export default FlagIcon` after it and import it everywhere in your app.
65+
// write `export default FlagIcon` as shown below and import it elsewhere in your app.
7966
const FlagIcon = FlagIconFactory(React)
8067
// If you are not using css modules, write the following:
8168
// const FlagIcon = FlagIconFactory(React, { useCssModules: false })
@@ -84,10 +71,11 @@ export default FlagIcon
8471
```
8572

8673
```js
87-
/* your-app/app.js */
74+
/* your-app/App.js */
75+
// @flow
8876
import * as React from 'react';
8977
import ReactDOM from 'react-dom'
90-
import FlagIcon from './your-components/FlagIcon.js'
78+
import FlagIcon from './your-components-directory/FlagIcon.js'
9179

9280
const App = (props = {}) =>
9381
<div>

0 commit comments

Comments
 (0)