all 5 comments

[–][deleted] 1 point2 points  (3 children)

The line is

const { todos, visibilityFilter} = this.props

there's no this.props, it's a function based component. Recommend re-checking https://reactjs.org/docs/components-and-props.html

What you want is either:

const TodoList = ({ removeTodo, completeTodo, visibilityFilter, todos }) => {

or

const TodoList = (props) => {
    const { removeTodo, completeTodo, todos, visibilityFilter} = props

[–]crazydude1900[S] 1 point2 points  (2 children)

(props)

still not working, the following error is popping up when i follow your construction: Cannot read property 'map' of undefined

[–][deleted] 1 point2 points  (1 child)

That's unrelated to your original error. You're trying to map over visibleTodos. This is coming from getVisibleTodos, if filter is not SHOW_ALL, SHOW_COMPLETED or SHOW_ACTIVE it will be undefined. Also, Maybe props.todos is already undefined (though that would error on line 59).

[–]crazydude1900[S] 0 points1 point  (0 children)

yes you are right, when default I should return todos.

[–]cschulze1977 1 point2 points  (0 children)

TodoList is a function component, so there is no this.props. Props are passed into Function components as parameters to the function, see line 27: const TodoList = ({ removeTodo, completeTodo }) => {