Locations in Ngeria
This package can easily be used with react project within form tag to get all locations in Nigeria.
All the 36 States and FCT
In the project directory, you can run:
- Easy to add into existing project
- Easy to style
- Get selected location on one click
How to use
- Install by executing
npm install nigeria-locations
oryarn add nigeria-locations
. - Import by adding
import States from 'nigeria-locations'
. - Use by adding
<States />
. UseonSelect
prop for getting new values.
Installation
Add nigeria-locations to your project by executing npm install nigeria-locations
or yarn add nigeria-locations
.
Usage
Here's an example of basic usage:
import React, { useState } from 'react';
import States from 'nigeria-locations';
function MyApp() {
const onChange = (state) => {
console.log(state);
};
return (
<div>
<States onSelect={onChange} />
</div>
);
}
User guide
nigeria-locations
Displays a complete, interactive select tag.
Styling
Prop name | Description |
---|---|
select-tag | Use this className to override the initial styling of the select tag |
option-tag | Use this className to override the initial styling of the tag tag |
onSelect | Create a function and pass the function as a prop to tag |
params | In the function created, pass a param in the function. Inside the function, you can get the value of the selected state, console the param in the function to see the selected state |