File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -355,21 +355,21 @@ The query `info` returned contains all information about the query and can be ea
355355function Todos () {
356356 const { status , data , error } = useQuery (' todos' , fetchTodoList)
357357
358+ if (status === ' loading' ) {
359+ return < span> Loading... < / span>
360+ }
361+
362+ if (status === ' error' ) {
363+ return < span> Error : {error .message }< / span>
364+ }
365+
366+ // also status === 'success', but "else" logic works, too
358367 return (
359- < div>
360- {status === ' loading' ? (
361- < span> Loading... < / span>
362- ) : status === ' error' ? (
363- < span> Error : {error .message }< / span>
364- ) : (
365- // also status === 'success', but "else" logic works, too
366- < ul>
367- {data .map (todo => (
368- < li key= {todo .id }> {todo .title }< / li>
369- ))}
370- < / ul>
371- )}
372- < / div>
368+ < ul>
369+ {data .map (todo => (
370+ < li key= {todo .id }> {todo .title }< / li>
371+ ))}
372+ < / ul>
373373 )
374374}
375375```
You can’t perform that action at this time.
0 commit comments