Socket
Socket
Sign inDemoInstall

react-select-cities

Package Overview
Dependencies
3
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-select-cities

This package built on [`react-select`](https://www.npmjs.com/package/react-select) to select cities, countries, regions, ..etc.


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

React-Select-Cities

This package built on react-select to select cities, countries, regions, ..etc.

Installation and usage

NPM

You can install it using npm

npm install react-select-cities

then use it in your app like this:

import React, { useState } from 'react';
import ReactSelect from 'react-select-cities';

function App() {
  const [inputValue, setValue] = useState("");

  return (
    <div className="App">
        <ReactSelect
          maxCountriesNumber={5}
          onInputChange={value => {
            const inputValue = value.replace(/\W/g, "");
            setValue(inputValue);
            return inputValue;
          }}
          inputValue={inputValue}
          onChange={(a, b) => {
            console.log("from Parent: ", a, b);
          }}
        />
    </div>
  );
}

export default App;

Props

PropTypeUsageNote
maxCountriesNumberNumberThe maximum number of countries you can select.you can select any number of cities/regions/zipcode under those countries, but you can't add another country.
onInputChangeFunctionfires when you change the input value.(inputValue) => { return inputValue;}
inputValueStringThe input value you enteredyou can manage it using state
onChangeFunctionFires when the value of cities changed(currentSelectedCities, lastAction) => {}

All the previous props are required and you have to set them.

FAQs

Last updated on 02 Oct 2019

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc