Sitemap

React-Select Package | React Tutorial

Create a Simple Select Option with React-Select Functional Component.

May 30, 2023

--

import React from "react";
import Select from "react-select";

Get Revive Coding’s stories in your inbox

Join Medium for free to get updates from this writer.

const options = [
{ value: "book", label: "book" },
{ value: "cycle", label: "cycle" },
{ value: "apple", label: "apple" }
];
function App() {
const [selectOption, setSelectOption] = React.useState(null);
return (
<React.Fragment>
<Select
defaultInputValue={selectOption}
onChange={setSelectOption}
options={options}
/>
</React.Fragment>
);
}
export default App;

--

--

Revive Coding
Revive Coding

Written by Revive Coding

Revive Coding is a place where you learn Web Development. Here we teach you, art of becoming Full Stack Web Developer and ready for your Dream Job.