mirror of
https://github.com/streamich/react-use.git
synced 2026-01-25 14:17:16 +00:00
Merge pull request #693 from uxitten/master
Added ActionsTabStory for log
This commit is contained in:
commit
4bd129010c
@ -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;
|
||||
};
|
||||
```
|
||||
|
||||
@ -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;
|
||||
};
|
||||
```
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user