nepal-localbodies-react
v1.1.0
Published
It is a custom react hook which returns 4 value: 1. localBodySelected: array of local bodies for selected district 2. districtSelected: array of districts for selected state 3. stateSelected: selected state 4. template: template for local body form
Downloads
3
Readme
nepal-localbodies-react
NPM Package for React to provide nepal local bodies for form
It is a custom react hook which returns 4 value:
- localBodySelected: array of local bodies for selected district
- districtSelected: array of districts for selected state
- stateSelected: selected state
- template: template for local body form
Setup
- Install dependencies
npm install nepal-localbodies-react
- Import the package
import useDistrictComponent from "nepal-localbodies-react/localBodies";
Use the package
Destructure the returned values
const {template, districtSelected, localBodySelected, provinceSelected} = useDistrictComponent();
- Use them in your form
import useDistrictComponent from "nepal-localbodies-react/localBodies";
function App() {
const {template, districtSelected, localBodySelected, provinceSelected} = useDistrictComponent();
return (
<div className="App">
{template}
<div>Current Province: {provinceSelected}</div>
<div>Current District: {districtSelected}</div>
<div>Current localBody: {localBodySelected}</div>
</div>
)
}
export default App;
Output: