I got little issue with my dropdown component that i imported from 'react-select', i am newbie at React so its pretty hard for me to solve this. i just want to get the selection of user from dropdown list, how can i do that?
for example this is the Dropdown component:
import React from 'react';
import Select from 'react-select';
import 'bootstrap/dist/css/bootstrap.min.css';
const techCompanies = [
{ label: "Button", value: 1 },
{ label: "CheckBox", value: 2 },
{ label: "Color", value: 3 },
{ label: "Date", value: 4 },
{ label: "Local Date time", value: 5 },
{ label: "Email", value: 6 },
{ label: "File", value: 7 },
{ label: "Hidden", value: 8 },
{ label: "Image", value: 9 },
{ label: "Month", value: 10 },
{ label: "Number", value: 11},
{ label: "Password", value: 12},
{ label: "Radio", value: 13},
{ label: "Range", value: 14},
{ label: "Reset", value: 15},
{ label: "Search", value: 16},
{ label: "Submit", value: 17},
{ label: "Telephone", value: 18},
{ label: "Text", value: 19},
{ label: "Time", value: 20},
{ label: "URL", value: 21},
{ label: "Week", value: 22},
];
class DropDown extends React.Component{
render(){
return(
<div className="container">
<div className="row">
<div className="col-md-4"></div>
<div className="col-md-4">
<Select
options={ techCompanies } />
</div>
<div className="col-md-4"></div>
</div>
</div>
);
}
}
export default DropDown
and now i want to use my dropdown at App.js and show in <h1>{userSelect}</h1>
the user selection, i cant find anyway to use pros ans state so i got stuck here:
class App extends Component {
render() {
return(
<div>
<DropDown/>
</div>
);
}
}
Thanks for helping