Merge pull request #693 from uxitten/master

Added ActionsTabStory for log
This commit is contained in:
Vadim Dalecky 2019-10-23 09:28:06 +01:00 committed by GitHub
commit 4bd129010c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 8 deletions

View File

@ -8,7 +8,7 @@ React lifecycle hook that calls a function after the component is mounted. Use `
import {useMount} from 'react-use';
const Demo = () => {
useMount(() => console.log('MOUNTED'));
useMount(() => alert('MOUNTED'));
return null;
};
```

View File

@ -8,7 +8,7 @@ React lifecycle hook that calls a function when the component will unmount. Use
import {useUnmount} from 'react-use';
const Demo = () => {
useUnmount(() => console.log('UNMOUNTED'));
useUnmount(() => alert('UNMOUNTED'));
return null;
};
```

View File

@ -1,13 +1,16 @@
import { storiesOf } from '@storybook/react';
import * as React from 'react';
import { useMount } from '..';
import ConsoleStory from './util/ConsoleStory';
import ShowDocs from './util/ShowDocs';
const Demo = () => {
useMount(() => console.log('MOUNTED'));
useMount(() => alert('MOUNTED'));
return <ConsoleStory />;
return (
<div>
<code>useMount()</code> hook can be used to perform a side-effect when component is mounted.
</div>
);
};
storiesOf('Lifecycle|useMount', module)

View File

@ -1,13 +1,17 @@
import { storiesOf } from '@storybook/react';
import * as React from 'react';
import { useUnmount } from '..';
import ConsoleStory from './util/ConsoleStory';
import ShowDocs from './util/ShowDocs';
const Demo = () => {
useUnmount(() => console.log('UNMOUNTED'));
useUnmount(() => alert('UNMOUNTED'));
return <ConsoleStory />;
return (
<div>
<code>useUnmount()</code> hook can be used to perform side-effects when component unmounts. This component will
alert you when it is un-mounted.
</div>
);
};
storiesOf('Lifecycle|useUnmount', module)