I am trying to populate select in [stateless component of] React/Redux app as:
const FillSelect = ({team}) => <option value={team.onboardingOrder}>{team.name}</option>
const TeamSelector = ({teams}) => {
return (
<select>
<option value="">All</option>
{
teams ? (teams => teams.map(team => <FillSelect team={team} />)) : null
}
</select>
)
}
Teams looks like:{0:{id: 1, name: "Program Management", onboardingOrder: 0, …}, 1: {id: 2, name: "Value Capture", onboardingOrder: 1, …}…}.
It returns an error: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
in select ...
Is this happening because I am using map()? What is the correct way of doing this?
mapan object. UseObject.values(teams).map...mapANY object, but iterables are supported, right? developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…