src/App.js
file. Include the following code in App.js file.Countries
array and passed the countries name along with their respective country code. We will show these countries name when a user clicks on the React dropdown select element with the help of the react-select library.render()
method and passed the HTML code inside of it such as container, row, and column from Bootstrap library to create the basic layout in our React app.options={..}
object and inside the options tag we passed the Countries array. This will do the magic and render the countries names as you can see in the screenshot above.Property | Detail |
---|---|
autofocus | Sets the Focus on control when it is mounted. |
onChange | Triggers change events. |
className | Adds a className on the outer component. |
classNamePrefix | Includes className to the inner elements. |
isDisabled | Sets the control to the disabled state. |
isMulti | Allows multiple value selection. |
value | It is referred to the current value. |
isSearchable | Enable the value search functionality. |
name | Name of the HTML Input (optional – without this, no input will be rendered). |
options | Allows to include options in the select dropdown. |
onInputChange | Triggers when any value changes in the input. |
placeholder | Show default value when no option is chosen. |
onBlur | Manages blur event on the control. |