M
M
mrrangerr2020-06-08 10:03:43
JavaScript
mrrangerr, 2020-06-08 10:03:43

How to render two independent arrays?

Hello everyone, two arrays arrive in my props from the parent component, I need to render these arrays in the component, how can I do this?
I manage to map only one array, in the example below I mapped selectValues, but the second selectOptions array does not work (

export const Select = ({ name, selectOptions, selectValues }) => {
    return (
        <select name={name} className="custom-select">
            {selectValues.map(value => (
                <option key={value} value={value}></option>
            ))}
        </select>
    )
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danil Zinchenko, 2020-06-08
@danilzin

What comes in the second array?)
Maybe it's empty?
Or maybe an object in general?
Print the array to the console and see what's there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question