Gathering detailed insights and metrics for @mwid/react-country-picker
Gathering detailed insights and metrics for @mwid/react-country-picker
Gathering detailed insights and metrics for @mwid/react-country-picker
Gathering detailed insights and metrics for @mwid/react-country-picker
npm install @mwid/react-country-picker
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
35
A country picker component with real-time autocomplete, built with React.
1# npm 2npm install @mwid/react-country-picker 3 4# Yarn 5yarn add @mwid/react-country-picker 6 7# pnpm 8pnpm add @mwid/react-country-picker
Import:
1// TypeScript / ESModules 2import { CountryPicker } from "@mwid/react-country-picker"; 3 4// CommonJS 5const { CountryPicker } = require("@mwid/react-country-picker");
Create a callback for when a country is selected:
1const onSelect = useCallback(() => { 2 // Do something 3}, []);
Add the CountryPicker
component to your JSX:
1<CountryPicker onSelect={onSelect} />
Property | Type | Default | Description |
---|---|---|---|
onSelect | (country: Country) => void | Called when a country is selected from the country list. |
Where Country
is:
1interface Country { 2 officialName: string; 3 commonName: string; 4 flagSvgUrl: string; 5}
src/ | Description |
---|---|
api | All API requests and their request and response body interfaces. Each request should be prefixed with its HTTP method (Eg, GET /countries/all -> getAllCountries ) and their request/responses named similarly (Eg, getAllCountriesRequest and getAllCountriesResponse ). |
components | React components. Each component resides in its own directory, and sub-components that only it uses are nested under it. Storybook stories are placed in component.stories.tsx , unit tests are placed in component.test.tsx and styled-components primitives are placed in component.style.tsx . |
config | Configuration-related items (that may be changed via environment variables) and constant values. |
hooks | Custom hooks shared across the entire component. |
lib | Re-exports of library functions and factories. Eg, create a database connection instance. |
slices | Redux state slices. Actions are placed in slice.actions.ts , reducers are placed in slice.reducer.ts , selectors are placed in slice.selectors.ts and entity adapters are placed in entity.entity.ts . |
test | Test-specific configuration and setup. Fixtures define unchanging mock data used across multiple tests. |
types | TypeScript types used across the component to define a contract on the structure of data. |
utils | Reusable utility functions and types. |
Install Node:
1curl -L https://git.io/n-install | bash 2n auto
Install dependencies:
1npm i
Run unit and integration tests:
1npm t
Develop in Storybook:
1npm run storybook
Build for production:
1npm run build
Script | Description |
---|---|
build | Build code for production with TypeScript. |
format:check | Check all code formatting with Prettier. |
format:write | Fix all code formatting with Prettier. |
lint | Lint all code with ESLint. |
test | Run all unit and integration tests. |
storybook | Start the Storybook development server. |
storybook:build | Build Storybook for publishing. |
This project is licensed under the MIT license.
No vulnerabilities found.
No security vulnerabilities found.