|
Download wp-calypso/client/components/data/query-country-states/README.md from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 917 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-country-states/README.md
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/components/data/query-country-states/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/components/data/query-country-states/README.md
917 Bytes
| # 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`. | |