Reputation: 907
I am trying to build a simple React app. I have a page with a table that I am currently trying to render with fake data. I can successfully navigate to and render the page, but when I do, only the header and none of my rows with data show up. Here is my code right now:
import React from 'react';
const Campus = (props) => {
const campus = {
name: 'Terra',
students: ['katie', 'lara'],
instructors: ['joe', 'bob']
}
return (
<table className='table'>
<thead>
<tr>
<th>Students</th>
</tr>
</thead>
<tbody>
{ console.log("students ", campus.students) }
{ campus.students && campus.students.map((student, idx) => {
<tr key={idx} >
<td>
{console.log('student is ', student)}
{student}
</td>
</tr>
})
}
</tbody>
</table>
);
}
export default Campus;
I can console.log the students' name inside the map, but when the page loads, nothing but the header shows up. It's very possible I'm missing something very obvious; I'm new to this.
Upvotes: 0
Views: 410