Lord Salforis Lord Salforis - 1 year ago 84
React JSX Question

React table with django namedtuple returns .map is not a function

I want to make a table of with django

but getting an error. Headers(which is list) works fine though.


info = [Info(id=5, location_id=861, f=None),Info(id=3, location_id=650, f=None)]
return render('index.html', {'info': info})


var headers = ['id', 'location', 'f']

var Table = React.createClass({
render: function() {
return (
<table className="table-hover">
{this.props.headers.map(function(name, index) {
return <th key={ index }>{name}</th>;
{this.props.tableContent.map(function(row, index) {
<tr key={index}>
{row.map(function(col, i) {
<td key={i}>{col}</td>

<Table headers={headers} tableContent={info}/>,

I can't see any output and the console says:
Uncaught TypeError: this.props.tableContent.map is not a function

Answer Source

I forgot to put safe when receiving the data. To someone who might encounter this problem too. Please refer to this question too

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download