reusable dropdown react code example
Example 1: import dropdown react
import { Dropdown } from 'react-bootstrap';
<div className="dropdown">
<Dropdown>
<Dropdown.Toggle
variant="secondary btn-sm"
id="dropdown-basic">
Language
</Dropdown.Toggle>
<Dropdown.Menu style={{backgroundColor:'#73a47'}}>
<Dropdown.Item href="#" >Arabic</Dropdown.Item>
<Dropdown.Item href="#">English</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
</div>
Example 2: react native dropdown
npm install --save react-native-material-dropdown
import React, { Component } from 'react';
import { Dropdown } from 'react-native-material-dropdown';
class Example extends Component {
render() {
let data = [
{ value: 'Banana', },
{ value: 'Mango', },
{ value: 'Pear', }];
return (
<Dropdown
label='Favorite Fruit'
data={data}
/>
);
}
}