Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react-select-search useSelect hook

import React from 'react';
import { useSelect } from 'react-select-search';

const CustomSelect = ({ options, value, multiple, disabled }) => {
    const [snapshot, valueProps, optionProps] = useSelect({
        options,
        value,
        multiple,
        disabled,
    });

    return (
        <div>
            <button {...valueProps}>{snapshot.displayValue}</button>
            {snapshot.focus && (
                <ul>
                    {snapshot.options.map((option) => (
                        <li key={option.value}>
                            <button {...optionProps} value={option.value}>{option.name}</button>
                        </li>
                    ))}
                </ul>
            )}
        </div>
    );
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: recordrtc 
Javascript :: .has javascript 
Javascript :: auto create a test file in angular 
Javascript :: random picture position in react 
Javascript :: react useref hook 
Javascript :: get width of html photo 
Javascript :: ngmodel validation angular 8 
Javascript :: how to do something once in javascript 
Javascript :: React-native-background-fetch 
Javascript :: new js 
Javascript :: create javascript set 
Javascript :: read dictionary values 
Javascript :: how to use settimeout in react 
Javascript :: how to connect a swagger ui express 
Javascript :: nested arrays reactjs tables 
Javascript :: javascript set() method 
Javascript :: vuetify use selected value 
Javascript :: stringy 
Javascript :: jquery traversing methods 
Javascript :: array class javascript 
Javascript :: check if jwt token is valid 
Javascript :: nvm use a particular version 
Javascript :: jsonwebtoken 
Javascript :: javascript array slice() example 
Javascript :: create object javascript 
Javascript :: binance js 
Javascript :: base64 to base64url javascript 
Javascript :: can we add string and int in javascript 
Javascript :: jquerey dropdown button 
Javascript :: launch json file for rust 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =