Command
npm i multiselect-react-dropdown
In App.js
import React, { useState } from "react";
import './App.css'
import {Multiselect} from 'multiselect-react-dropdown';
export default function App() {
const options= [{name: 'Srigar', id: 1},{name: 'Sam', id: 2}]
const [data,setData] = useState(options);
const onSelect = (data) => {
console.log(data)
}
const onRemove = (data) => {
console.log(data)
}
return (
<div className="chat-container">
<Multiselect
options = {data}
displayValue="name"
onSelect={onSelect}
onRemove = {onRemove}
/>
</div>
)
}
Comments
Post a Comment