React — Syntax error: Unexpected token, expected ;

Viewed 27079

For some reason that I can't figure it out I am getting a syntax error in the following React component. The error is in the first curly bracket on the renderItem(). What's wrong?

Thank you in advance.

import _ from 'lodash';
import React from 'react';
import { ToDoListHeader } from './todo-list-header';
import { ToDoListItem } from './todo-list-item';

export const ToDoList = (props) => {
  renderItems() {
    return _.map(this.props.todos, (todo, index) => <ToDoListItem key={index} {...todo} />)
  }

  return (
    <div>
      <table>
        <ToDoListHeader />
        <tbody>
          {/* {this.renderItems()} */}
        </tbody>
      </table>
    </div>
  );
}
2 Answers
Related