country-phone-code-yube
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

import { CountryPhoneCode } from 'country-phone-code-yube';

import React, { useState } from 'react';

interface CountryData { code: string; name: string; phone: string;

}

const App: React.FC = () => {

const [selectedCountry, setSelectedCountry] = useState<CountryData | null>(null);

const [phoneNumber, setPhoneNumber] = useState('');

const handleCountrySelection = (country: CountryData) => { console.log('Selected Country:', country); setSelectedCountry(country); // Store selected country data if needed };

const handlePhoneNumberChange = (newPhoneNumber: string) => { setPhoneNumber(newPhoneNumber); // Update state dynamically };

return (

Select a Country

  {selectedCountry && (
    <div className="mt-4">
      <h2>Selected Country Details:</h2>
      <p>Country: {selectedCountry.name}</p>
      <p>Phone Code: {selectedCountry.phone}</p>
      {phoneNumber && (
        <p style={{ marginTop: '10px' }}>
          <strong>Your Phone Number: </strong> {phoneNumber}
        </p>
      )}
    </div>
  )}
</div>

); };

export default App;

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.52latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.52
1.0.41
1.0.31
1.0.21
1.0.10
1.0.00

Package Sidebar

Install

npm i country-phone-code-yube

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

66.8 kB

Total Files

16

Last publish

Collaborators

  • yube