An open API service indexing awesome lists of open source software.

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).

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: