File size: 917 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# 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.
```jsx
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`
<table>
<tr><th>Type</th><td>String</td></tr>
<tr><th>Required</th><td>Yes</td></tr>
</table>
The country code for which states should be requested. Example: `us`, `ca`.
|