mirror of
https://github.com/streamich/react-use.git
synced 2026-02-01 14:37:31 +00:00
Also reduce max line width to 100. And remove `lint:types` step for commit sequence, it bothers when committing incomplete (wip) changes.
25 lines
660 B
TypeScript
25 lines
660 B
TypeScript
import { storiesOf } from '@storybook/react';
|
|
import * as React from 'react';
|
|
import { useEffect } from 'react';
|
|
import { useNetworkState } from '../src';
|
|
import ShowDocs from './util/ShowDocs';
|
|
|
|
const Demo = () => {
|
|
const state = useNetworkState();
|
|
|
|
useEffect(() => {
|
|
console.log(state);
|
|
}, [state]);
|
|
|
|
return (
|
|
<div>
|
|
<div>Since JSON do not output `undefined` fields look the console to see whole the state</div>
|
|
<pre>{JSON.stringify(state, null, 2)}</pre>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
storiesOf('Sensors/useNetworkState', module)
|
|
.add('Docs', () => <ShowDocs md={require('../docs/useNetworkState.md')} />)
|
|
.add('Demo', () => <Demo />);
|