https://github.com/srph/react-dynamic-select
[WIP] Create native `select` elements with dynamic options (usually fetched from AJAX).
https://github.com/srph/react-dynamic-select
Last synced: 2 months ago
JSON representation
[WIP] Create native `select` elements with dynamic options (usually fetched from AJAX).
- Host: GitHub
- URL: https://github.com/srph/react-dynamic-select
- Owner: srph
- Created: 2017-08-06T11:45:40.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-06T11:46:03.000Z (almost 9 years ago)
- Last Synced: 2025-01-26T17:15:47.592Z (over 1 year ago)
- Language: JavaScript
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Dynamic Select
[WIP] Create native `select` elements with dynamic options (usually fetched from AJAX).
## Why?
Autocomplete components like react-select work great, but too heavy for simple use-cases!
## Installation
```
npm i @srph/react-dynamic-select
```
## Usage
```js
import React from 'react';
import DynamicSelect from '@srph/react-dynamic-select';
import axios from 'axios';
class App extends React.Component {
state = {
color: ''
}
render() {
return (
Favorite Color
);
}
options() {
axios.get('x').then(res => {
return res.data.colors;
});
}
handleChange(evt) {
this.setState({ color: evt.target.value });
}
}
export default App;
```
## API Documentation
Here's a list of props you may use to customize the component for your use-case: