From 338c11a4da2a315ab2160be0bc4c1d261c7708d2 Mon Sep 17 00:00:00 2001 From: Przemek K Date: Sat, 18 Apr 2020 13:59:28 +0100 Subject: [PATCH] Extract status for the easier readability in simple example - docs --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) 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 - - )} -
+ ) } ```