0.1.7 • Published 10 months ago

react-js-country-flags v0.1.7

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

react-country-flag

Install

npm install --save react-js-country-flags

Result

Usage

Pass the country code or dial_code to get details/flag/flag emoji

import React from "react"
import {getFlagsByDialCode,getFlagByCountryName,getFlagEmojiByCountryName,getCountryDetailsByName} from "react-js-country-flags";

function App() {

  const countryList1 = getFlagsByDialCode("+1")
  const countryList91 = getFlagsByDialCode("+91")
  return (
    <div className="App" style={{padding:"10px"}}>
      <p>Country flag by dial code +1 : {JSON.stringify(countryList1)}</p>
      {countryList1.map((country)=> <img key={country.dial_code} src={country.flag} style={{height:'30px',width:'30px',marginRight:'10px'}}/>)}
      <br/>

      <p>Country flag by dial code +91 : {JSON.stringify(countryList91)}</p>
      {countryList91.map((country)=> <img key={country.dial_code} src={country.flag} style={{height:'30px',width:'30px',marginRight:'10px'}}/>)}
      <br/>

      <p>Country flag by name US</p>
       <img src={getFlagByCountryName("US")} style={{height:'30px',width:'30px'}}/>
      <br/>
 
      <p>country Emoji {getFlagEmojiByCountryName("in")}</p>


      <p>Country details by name IN : {JSON.stringify(getCountryDetailsByName("in"))}</p>
     
      <br/>

    </div>
  );
}

export default App;

Detecting Emoji support

Try this out and conditionally render your country flag https://github.com/danalloway/detect-emoji-support

License

MIT © UdaySubbisetty

0.1.7

10 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago