1.0.10 • Published 3 years ago

select-react-app v1.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Select-React-App

Install

  • npm install select-react-app

How to use

  • Example :

    import { Select, Option } from 'select-react-app'
    
    function HomePage() {
              
     const [selected, setSelected] = useState<any>({
      value: "me",
      label: "Me",
    });
    const [selected2, setSelected2] = useState<any>({
      value: "me",
      label: "Me",
    });
    const opts = [
      { value: "me", label: "Me" },
      { value: "you", label: "You" },
      { value: "them", label: "Them" },
    ];
    
    const [index, setIndex] = useState(0);
    
    return (
      <div>
        selected index : {index}
        <Select
          width="20vw"
          value={selected}
          index={1}
          selectedIndex={index}
          updateIndex={setIndex}
          displayValue={"label"}
        >
          {opts?.map((option) => (
            <Option key={option.value} value={option} setValue={setSelected}>
              {option.label}
            </Option>
          ))}
        </Select>
        <Select
          width="20vw"
          value={selected2}
          displayValue={"label"}
          selectedIndex={index}
          index={2}
          updateIndex={setIndex}
        >
          {opts?.map((option) => (
            <Option key={option.value} value={option} setValue={setSelected2}>
              {option.label}
            </Option>
          ))}
        </Select>
      </div>
    );
    } 
1.0.10

3 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago