Skip to content

Commit 12666b9

Browse files
ACollectionOfAtomstimdorr
authored andcommitted
Get rid of console warnings in TodoApp of docs (#2711)
* Get rid of console warnings in TodoApp of docs Add default case for `getVisibleTodos` and remove `#` from href in `Link.js` * Update ExampleTodoList.md
1 parent ef2ce0e commit 12666b9

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

docs/basics/ExampleTodoList.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ const Link = ({ active, children, onClick }) => {
182182

183183
return (
184184
<a
185-
href="#"
185+
href=""
186186
onClick={e => {
187187
e.preventDefault()
188188
onClick()
@@ -259,12 +259,13 @@ import TodoList from '../components/TodoList'
259259

260260
const getVisibleTodos = (todos, filter) => {
261261
switch (filter) {
262-
case 'SHOW_ALL':
263-
return todos
264262
case 'SHOW_COMPLETED':
265263
return todos.filter(t => t.completed)
266264
case 'SHOW_ACTIVE':
267265
return todos.filter(t => !t.completed)
266+
case 'SHOW_ALL':
267+
default:
268+
return todos
268269
}
269270
}
270271

docs/basics/UsageWithReact.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ const Link = ({ active, children, onClick }) => {
179179

180180
return (
181181
<a
182-
href="#"
182+
href=""
183183
onClick={e => {
184184
e.preventDefault()
185185
onClick()
@@ -235,12 +235,13 @@ To use `connect()`, you need to define a special function called `mapStateToProp
235235
```js
236236
const getVisibleTodos = (todos, filter) => {
237237
switch (filter) {
238-
case 'SHOW_ALL':
239-
return todos
240238
case 'SHOW_COMPLETED':
241239
return todos.filter(t => t.completed)
242240
case 'SHOW_ACTIVE':
243241
return todos.filter(t => !t.completed)
242+
case 'SHOW_ALL':
243+
default:
244+
return todos
244245
}
245246
}
246247

0 commit comments

Comments
 (0)