I am trying to map an array of data, but keep getting the error: Cannot read property 'map' of undefined for this line: {number.s[0].l['serial'].map(option =>
This is my code:
{this.state.serials.map((number) => { return number.s && number.s.length? (<h2 > {number.s[0].za}</h2><ul> {number.s[0].l['serial'].map(option => <li>{option}</li> )}</ul> ) : null})}
This is my data:
[ {"s": [ {"l": [ { "serial":"49:42:06:00:20:4e" }, { "serial":"49:42:06:00:3b:29" } ],"za":"900" } ] }, {"s": [ {"l": [{ "serial":"777" }],"za":"5559" } ] }]
Does anyone know how I should define the path to map serials from "l"? I defined it in many different ways, however, I can't seem to get it working.
Thanks in advance!