Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question