diff --git a/README.md b/README.md index ef6b3976bb..769d1b41fb 100644 --- a/README.md +++ b/README.md @@ -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 Loading... + } + + if (status === 'error') { + return Error: {error.message} + } + + // also status === 'success', but "else" logic works, too return ( -
- {status === 'loading' ? ( - Loading... - ) : status === 'error' ? ( - Error: {error.message} - ) : ( - // also status === 'success', but "else" logic works, too - - )} -
+ ) } ```