Sunday, 12 September 2021

React select npm onBlur function returns An error

Hi everyone I have been an issue with the react-select onBlur function, I tried Lot search and git issues referred but till now didn't get an answer searched a lot of places, OnBlur function selected values do not get it,I value of onblur are sown undefined,I think duplicated are some, But searched but I can't find an exact answer if the answer available please suggest Me, Thanks for the help

Codesanbox Link for refernce:https://codesandbox.io/s/strange-sun-uojxs?file=/src/App.js:0-693

import React, { useState } from "react";
import Select from "react-select";
import "./styles.css";

export default function App() {
  const [value, setValue] = useState();
  const options = [
    {
      label: "first option",
      value: 1
    },
    {
      label: "second option",
      value: 2
    },
    {
      label: "third option",
      value: 3
    }
  ];

  const onSelect = (value) => {
    setValue(value);
  };
  const onBlurValue = (value) => {
    console.log(value);
  };

  return (
    <div>
      <Select
        value={options.label}
        options={options}
        onChange={onSelect}
        blurInputOnSelect
        onBlur={onBlurValue}
      />
    </div>
  );
}


from React select npm onBlur function returns An error

No comments:

Post a Comment