I am following the official redux tutorial with this code (it works!)
const TodoList = ( {todos} ) => (
<ul>
{ todos.map( todo =>
<li key={todo.id}>{todo.name}</li>
)}
</ul>
)
I have been playing around with the syntax and this also works:
const TodoList = ( {todos} ) => (
<ul>
{ todos.map( todo => {
return <li key={todo.id}>{todo.name}</li>
})}
</ul>
)
but this does not work:
const TodoList = ( {todos} ) => (
<ul>
{ todos.map( todo => {
<li key={todo.id}>{todo.name}</li>
})}
</ul>
)
Can anyone explain the difference between them and why the third one fails?