Skip to content

Commit

Permalink
Align useAsync and useAsyncRetry demos
Browse files Browse the repository at this point in the history
  • Loading branch information
wardoost committed Mar 31, 2019
1 parent 2c49244 commit e448d0d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/__stories__/useAsync.story.tsx
Expand Up @@ -10,13 +10,15 @@ const fn = () => new Promise<string>((resolve) => {
});

const Demo = () => {
const {loading, value} = useAsync<string>(fn);
const {loading, error, value} = useAsync<string>(fn);

return (
<div>
{loading
? <div>Loading...</div>
: <div>Value: {value}</div>
: error
? <div>Error: {error.message}</div>
: <div>Value: {value}</div>
}
</div>
);
Expand Down
12 changes: 6 additions & 6 deletions src/__stories__/useAsyncRetry.story.tsx
Expand Up @@ -19,13 +19,13 @@ const DemoRetry = () => {

return (
<div>
{loading?
<div>Loading...</div>
: error?
<div>Error: {error.message}</div>
: <div>Value: {value}</div>
{loading
? <div>Loading...</div>
: error
? <div>Error: {error.message}</div>
: <div>Value: {value}</div>
}
<a href='javascript:void 0' onClick={() => retry()}>Retry</a>
<button onClick={() => retry()}>Retry</button>
</div>
);
};
Expand Down

0 comments on commit e448d0d

Please sign in to comment.