You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
35
36
36
```js
37
+
// @flow
37
38
import*asReactfrom'react';
38
39
importFlagIconFactoryfrom'react-flag-icon-css'
39
40
40
41
// Please only use `FlagIconFactory` one time in your application, there is no
41
42
// need to use it multiple times (it would slow down your app). You may place the
42
43
// line below in a `FlagIcon.js` file in your 'components' directory, then
43
44
// write `export default FlagIcon` after it and import it everywhere in your app.
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.*
67
68
68
69
```js
70
+
/* your-app/your-components/FlagIcon.js */
69
71
// @flow
70
72
import*asReactfrom'react'
71
-
importReactDOMfrom'react-dom'
72
73
importFlagIconFactoryfrom'react-flag-icon-css'
73
74
74
75
// Please only use `FlagIconFactory` one time in your application, there is no
75
76
// need to use it multiple times (it would slow down your app). You may place the
76
77
// line below in a `FlagIcon.js` file in your 'components' directory, then
77
78
// write `export default FlagIcon` after it and import it everywhere in your app.
78
-
constFlagIcon=FlagIconFactory(React.default)
79
+
constFlagIcon=FlagIconFactory(React)
79
80
// If you are not using css modules, write the following:
0 commit comments