Semantic UI dropdown field not displaying selected option text

I've encountered an issue while working with React Semantic UI. I'm trying to render a dropdown and have configured it so that the selected option's text should display in the field. However, when I choose an option from the dropdown, instead of showing the selected value's text, the field remains empty.

Below is the code snippet for my dropdown:

options = [
  { key:"a", value: 1, name: 'uni',  text: "first"},
  { key:"b", value: 2, name: 'duo',  text: 'second'},
  { key:"c", value: 3, name: 'tri',  text: 'third'},
  { key:"d", value: 4, name: 'quart', text: 'fourth'},
  { key:"e", value: 5, name: 'cinq',  text: 'fifth'},
  { key:"f", value: 6, name: 'dernier', text: 'last'}
];

const handleDropDownSelect = (event, data) => {
    onChangeValue(data.value)
};

const Dropdown = () => (
      return(
      <Dropdown
          placeholder="abc"
          fluid
          selection
          options={options}
          onChange={handleDropDownSelect}
      />
);

<DropDownContainer className="Dropdown">
            <Dropdown />
</DropDownContainer>

The function onChangeValue is used in another component where I receive the value from this dropdown and update other components. The problem lies in the fact that upon selecting an option, the associated text should be visible in the dropdown field rather than being blank.

Answer №1

Success! I was able to fix the issue by making changes to the options array.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Positioning a Three.js static CSS2DObject with respect to the camera's perspective

I am currently working on a unique program visualizer that utilizes Three.js to showcase various aspects of a program to the user. One crucial feature of this visualizer is allowing users to click on specific objects to view additional information about th ...

Using VueJS to determine if a certain string includes a specific substring within an if-statement embedded within a v

I am aiming to verify if the link in a json object contains 'http'. If it does, I want to assign a target='_blank' attribute to the v-btn. The link could also be something like #test. Currently, this is how I am attempting to achieve i ...

Submitting the form with a target of _blank will result in the form being submitted on both a

I am currently working on a form that includes both a "Submit" button and a "Preview" button. While the submit button is functioning correctly, I am experiencing an issue with the Preview button. When clicked, it opens up a new page with the preview as in ...

How can you invoke a component method from a different component in a react-redux setup?

Currently in the process of developing a React Native app that features an audio player. This audio player will have its own view with controls such as Play, Stop, and Skip. The challenge I am facing is ensuring that this audio player can be controlled fro ...

Modifying the value of a property in an object array created using the map method is ineffective

I have a collection of objects: https://i.sstatic.net/XNrcU.png Within the collection, I wished to include an additional property to the objects. To achieve this, I utilized the map function: returnArray = returnArray.map((obj) => { obj.active = "fal ...

retrieving information from server via ajax to display on chart

I am currently utilizing the jqPlot JavaScript library for generating graphs and charts in one of my applications, which can be found at . Within my application, there are approximately 5-6 pages where I have integrated this library. However, I would like ...

The battle between Hover, Focus, and Blur modes intensifies

My goal is to implement 4 different effects on an element: When hovering over the element. When moving away from the element. When focusing on the element. When blurred. However, I'm encountering a conflict where when I focus on the element, the ...

Identify the general type according to a boolean property for a React element

Currently, I am facing a scenario where I need to handle two different cases using the same component depending on a boolean value. The technologies I am working with include React, Typescript, and Formik. In one case, I have a simple select box where th ...

Incorporate a Flask variable into a webpage seamlessly without refreshing the page

I am facing a challenge in importing the variable test_data from Flask to my webpage without having to reload it. I have tried clicking a button, but haven't been successful so far. Any suggestions? Flask: @blueprint.route('/data_analysis' ...

Issue with React-Native Picker - managing item selection

Encountering an issue with the Picker picker component. There is an array of currencies as strings. Using the Picker to select items from this array, and have a function included in the onValueChange prop in Picker. The problem arises when trying to select ...

What is the best way to align the Card Content with the MaterialUI Card Action button?

In my React application, I am incorporating Material UI Cards along with Bootstrap for div alignment. Below is the code snippet for the Card component: <Card elevation={10} className="mb-3"> <div className="row"> <d ...

Accessing the current clicked item in $scope using an Angular Directive within ng-repeat

I have set up a custom directive called calendar which includes a date picker created in JQuery. To associate the ng-model with the date picker, I am using the following code successfully: var clickedID = "#" + $scope.indexid + "_datePicker"; $(clickedID ...

In Javascript, when declaring a variable, check if a field is filled and assign its value if so; otherwise, set a default value

In the code snippet below, there are some rows with a nested field value present and some without. I am attempting to assign a value if the field is present, otherwise I want to set it as 'false'. Despite using the double pipe operator to handle ...

Upon initiating a refresh, the current user object from firebase Auth is found to be

Below is the code snippet from my profile page that works perfectly fine when I redirect from the login method of AuthService: const user = firebase.auth().currentUser; if (user != null) { this.name = user.displayName; this.uid = user.uid; } e ...

Transitioning the implicit width

Using implicit width, which involves adding padding to an element containing text to give the parent container a specific but unstated width, can be quite elegant. However, it poses challenges when it comes to transitions. Is there a way to achieve a trans ...

steps for retrieving final outcome from forkJoin

I am currently working with an array of userIds, such as: ['jd', 'abc']. My goal is to loop through these userIds and retrieve full names using an API. Ultimately, I aim to transform the initial array into [ {userId: 'jd', nam ...

Troubleshooting an HTML Design Flaw: How to create a 3x3 table with

I have been attempting to design a HTML page with a 3x3 layout. Despite trying various methods, including divs and tables, I am having difficulty achieving equal spacing around the centered image and the other table rows. Below is an example of the layout ...

Receiving the final outcome of a promise as a returned value

Seeking to deepen my comprehension of promises. In this code snippet, I am working on creating two promises that will return the numbers 19 and 23 respectively. However, when attempting to console log the value returned from the first promise, I encounte ...

Error handling in angularJS can be quite challenging at times,

Currently, I am experimenting with AngularJS to develop an application, and I have encountered a challenge related to the $scope context. This is the main file of my app: var app = angular.module('app', [ 'matchCtrl', &apos ...

Navigating the process of querying a MySQL database from a Google Cloud SQL instance in a React

I am attempting to retrieve user tables from my MySQL database after successfully connecting it using MySQL Workbench. Following the documentation, I understand that I need to utilize the express API for this task. Despite installing the API and coding ex ...