0

console.log(test)

image click

The picture shows django's data by using console.log(test) in react.

my code

<Select placeholder="Select a player" style={{ width:'150px' }}>
<Option>{test.name}/Option>
</Select>

What I want is to put the name of the test data in the select option.

How can I get what I want?

1 Answers1

0

If you mean that you want to iterate through the options and pass them as children of Select tag, please read this; You can use map function, something like this:

<select>
 {Data.map(option => <Option>{option.name} </Option>)}
</select>
user1452221
  • 124
  • 2
  • 9