react-select-nigeria-states-lga

    1.0.2 • Public • Published

    react-select-nigeria-states-lga

    A React Select library for Nigeria States to get LGA of selected states

    NPM JavaScript Style Guide

    Demo

    Live demo: [http://emmanuelchilaka.com/react-select-nigeria-states-lga/]

    Install

    npm install --save react-select-nigeria-states-lga

    Usage

    import React, {useState} from 'react'
    import { ReactNaijaStateLgaSelect } from 'react-select-nigeria-states-lga'
    
    const App = () => {
      const [towns, setLga] = useState([]);
      const [naijaState, setNaijaState] = useState('');
      const [naijaLga, setNaijaLga] = useState('');
    
      return <ReactNaijaStateLgaSelect 
                naijaState={naijaState}
                naijaLga={naijaLga}
                towns={towns}
                setNaijaState={setNaijaState}
                setNaijaLga={setNaijaLga}
                setLga={setLga}
             />
    }
    
    export default App

    States and LGA data

    Full list of states.

    Props

    stateVal

    stateVal is a required function prop that holds the current value of the selected Nigeria State.

        <ReactNaijaStateLgaSelect
          ...
          stateVal={val => setSelectedState(val)}
        />

    lgaVal

    lgaVal is a required function prop that holds the current value of the selected Nigeria State, selected LGA.

        <ReactNaijaStateLgaSelect
          ...
          lgaVal={val => setSelectedLga(val)}
        />

    statePlaceholder

    statePlaceholder is an optional string prop used replace the default placeholder text for the state select input.

        <ReactNaijaStateLgaSelect
        statePlaceholder="Select State" />

    lgaPlaceholder

    lgaPlaceholder is an optional string prop used replace the default placeholder text for the lga select input.

        <ReactNaijaStateLgaSelect
        lgaPlaceholder="Select State" />

    stateClassName

    stateClassName is an optional string prop used to pass a className to the state select input.

        <ReactNaijaStateLgaSelect
          ...
          stateClassName="style-select"
        />

    lgaClassName

    lgaClassName is an optional string prop used to pass a className to the lga select input.

        <ReactNaijaStateLgaSelect
          ...
          lgaClassName="style-select"
        />

    License

    This project is distributed under the MIT license. © echilaka1

    Install

    npm i react-select-nigeria-states-lga

    DownloadsWeekly Downloads

    5

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    101 kB

    Total Files

    7

    Last publish

    Collaborators

    • echilaka1