Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sm-country-info

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sm-country-info

A React component package for retrieving country information.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

sm-country-info

A React component package for retrieving country information.

Installation

You can install the package via npm:

npm install sm-country-info

## Usage

Example usage in a React component:

import React, { useEffect, useState } from 'react';
import { getCountryInfo } from 'sm-country-info';

const App = () => {
    const [countryInfo, setCountryInfo] = useState(null);

    useEffect(() => {
        const fetchData = async () => {
            try {
                const data = await getCountryInfo('India');
                setCountryInfo(data[0]); // Assuming the API returns an array of countries and we want the first one
            } catch (error) {
                console.error('Error fetching country data:', error.message);
            }
        };

        fetchData();
    }, []);

    return (
        <div>
            <h1>Country Information</h1>
            {countryInfo && (
                <div>
                    <p>Country Name: {countryInfo.name.common}</p>
                    <p>Country Capital: {countryInfo.capital}</p>
                    {/* Add more details as needed */}
                </div>
            )}
        </div>
    );
};

export default App;


NPM Version Badge:

npm version

Keywords

FAQs

Package last updated on 01 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc