I am building a react app which will display courses and authors, both courses and authors array's i have to display the list of courses and their corresponding authors. i have used the array map method to map over all courses and display them but i am getting stuck how to display the corresponding authors. below is my code
import React from "react";
import PropTypes from "prop-types";
import { Link } from "react-router-dom";
import { toast } from "react-toastify";
function CourseList(props) {
return (
<table className="table">
<thead>
<tr>
<th> </th>
<th>Title</th>
<th>Author Name</th>
<th>Category</th>
</tr>
</thead>
<tbody>
{props.courses.map(course => {
return (
<tr key={course.id}>
<td>
<button
className="btn btn-outline-danger"
onClick={() => {
props.deleteCourse(course.id);
toast.success("Course Deleted");
}}
>
Delete
</button>
</td>
<td>
<Link to={"/course/" + course.slug}>{course.title}</Link>
</td>
<td>{props.authors.name}</td>
<td>{course.category}</td>
</tr>
);
})}
</tbody>
</table>
);
}
CourseList.propTypes = {
deleteCourse: PropTypes.func.isRequired,
courses: PropTypes.arrayOf(
PropTypes.shape({
id: PropTypes.number.isRequired,
title: PropTypes.string.isRequired,
authorId: PropTypes.number.isRequired,
category: PropTypes.string.isRequired
})
).isRequired
};
export default CourseList;
could anyone please help me in displaying the author name in author name cell.

props.authors.name? Shouldn't it becourse.authors.name?