> React component for emoji/svg country flags.
npm install react-country-flag> React component for emoji/svg country flags.


``bash`
npm install --save react-country-flag
v3.x NONE
only Typescript Types were introduced, enjoy!
v2.x has breaking changes
- code is now countryCodetitle
- and aria-label are not defined any more, it is up to the developerstyleProps
to pass these in
- is now style
All props are passed onto the element, everything can be overwritten.
`jsx
import React from "react"
import ReactCountryFlag from "react-country-flag"
function ExampleComponent {
return (
countryCode="US"
style={{
fontSize: '2em',
lineHeight: '2em',
}}
aria-label="United States"
/>
svg
style={{
width: '2em',
height: '2em',
}}
title="US"
/>
svg
cdnUrl="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.4.3/flags/1x1/"
cdnSuffix="svg"
title="US"
/>
export default ExampleComponent
``
Try this out and conditionally render your country flag
https://github.com/danalloway/detect-emoji-support
MIT © danalloway