Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,21 +355,21 @@ The query `info` returned contains all information about the query and can be ea
function Todos() {
const { status, data, error } = useQuery('todos', fetchTodoList)

if (status === 'loading') {
return <span>Loading...</span>
}

if (status === 'error') {
return <span>Error: {error.message}</span>
}

// also status === 'success', but "else" logic works, too
return (
<div>
{status === 'loading' ? (
<span>Loading...</span>
) : status === 'error' ? (
<span>Error: {error.message}</span>
) : (
// also status === 'success', but "else" logic works, too
<ul>
{data.map(todo => (
<li key={todo.id}>{todo.title}</li>
))}
</ul>
)}
</div>
<ul>
{data.map(todo => (
<li key={todo.id}>{todo.title}</li>
))}
</ul>
)
}
```
Expand Down