From d84ef8c61bf44789512e06a42be77159b9cbcb0f Mon Sep 17 00:00:00 2001 From: DavidWells Date: Fri, 15 Jun 2018 13:12:37 -0700 Subject: [PATCH] handle empty todos --- src/App.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/App.js b/src/App.js index 4ac6b9b..1488b4d 100644 --- a/src/App.js +++ b/src/App.js @@ -152,6 +152,11 @@ class App extends Component { } renderTodos() { const { todos } = this.state + + if (!todos || !todos.length) { + return null + } + return todos.map((todo, i) => { const { data, ref } = todo const id = getTodoId(todo)