Question: When I run this code, I get the error:

> 
> unexpected token, expected ,
> 
> 
> 

All I am doing is calling a map method on an array:

```
const Available = ({prod}) => {
    let keys = Object.keys(prod)
    var filtered = keys.filter((item, index) => prod[item])
    return (
        {
            filtered.map((item, index) => {
            return <li><a>{item}</a></li>
        })
}
    )

}

Available.defaultProps = {
    Prod: {
        nuts: true,
        bolts: true,
        wiper: false,
        discbreak: true
    }
}

const Drop = (props) => {
    var style = {
        display: 'block'
    }
    if (props.isOpen) {
        return (
            <ul className="dropdown-menu" style={style}>
                <Available />
            </ul>
        )
    } else {
        return false
    }
}

```

I even tried changing 'Available' Component to as below.

```
const AvailableProducts = ({products}) => {
  debugger;
  let keys = Object.keys(products);
  var filtered = keys.filter((item,index)=>products[item]);

  filtered.map((item,index)=>{
    return <li><a>{item}</a></li>
  })
}

```

Now I end up getting error:

> 
> A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.
> 
> 
> 

Where am i doing wrong? Can someone help on this?

Answer: 
The reason is simple:

`background` is declared as a `Item` - and `Item` has no `color`, so you can't change it, before it is assigned a concrete `Item` that has a `color`. So when you execute the `QML`-file, the `Rectangle` is not yet available, until everything is created. This is when the `Binding` will set the color.

If you don't need it to be bound to anything, another solution is to use:

```
Component.onCompleted: background.color = 'green'

```

Otherwise, I deem the `Binding`-trick to be fine (*but this is opinion!*)
I'm not sure why you're changing the background color of your item delegate. The normal way to visually highlight the selected item in a ListView is to create a component (usually using a rectangle) and assign it to the ListView's highlight property, then set the ListView's highlightFollowsCurrentItem to true. The ListView will hide and show the highlight component as appropriate when the currentIndex changes, and you can specify various transition effects if you desire.