Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified

Query Country States

<QueryCountryStates /> is a React component used in managing network requests for states of a specific country.

Usage

Render the component, passing countryCode. It does not accept any children, nor does it render any elements to the page. You can use it adjacent to other sibling components which make use of the fetched data made available through the global application state.

import QueryCountryStates from 'calypso/components/data/query-country-states';

export default function MyStatesList( { countryStates } ) {
    return (
        <ul>
            <QueryCountryStates countryCode="us" />
            { countryStates.map( ( state ) => (
                <li>{ state.name }</li>
            ) ) }
        </ul>
    );
}

Props

countryCode

TypeString
RequiredYes

The country code for which states should be requested. Example: us, ca.