I have another react newbie question, I am trying to load some json data from an external, local, file called intro.json
But I am getting the error default.map is not a function
. Any ideas on what I am doing wrong here?
My data looks like this
{
"company": "test",
"employees":[
{
"firstName":"John",
"lastName":"Doe"
},
{
"firstName":"Anna",
"lastName":"Smith"
}
]
}
I am importing like so, which I thought might work because i'm doing something similar elsewhere but not as an external file.
import React, {PropTypes} from 'react';
import data from './intro.json';
var dataList = data.map(function(dl, index) {
return (
<li key={index}>{dl.company}</li>
)
});
....