Topic: MDBSelect get the sSelectedData value

cariforef priority asked 2 years ago

Hy, I want to get to selectedData value, but I get an error on the e element because it is defined as a SelectedData | SelectedData[] type... How can I get the e.value of the selected item. It is a single select, not multiple, so the e should be a SelectedData and not an array.

            label="Trier par"
            onValueChange={(e) => {
              search.set("sort", e.value);
              setSearch(search, {
                replace: true,
                text: "Intitulé ASC",
                value: "for_intitule_txt_fr asc",
                text: "Date de début",
                value: "date_debut_session_dt asc",
                defaultSelected: true,
                text: "Ville DESC",
                value: "ville_lieu_formation_s desc",

The console log send me the correct object SeletedData :

{ "text": "Ville DESC", "value": "ville_lieu_formation_s desc" }

Thanks, Didier

Krzysztof Wilk staff commented 2 years ago


Can you show me the error message you got or create a simple app on GitHub to show the issue? Everything looks fine in your code. I'm afraid I can't reproduce it on my side right now because I don't have an access to your states or methods you are using in onValueChange :)

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB React
  • MDB Version: MDB5 4.0.0
  • Device: MAC
  • Browser: Chrome
  • OS: MAC OS 10.15
  • Provided sample code: No
  • Provided link: No