Skip to content

Commit 7f1ed91

Browse files
committed
Polish demo
1 parent eda7e82 commit 7f1ed91

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

src/index.stories.tsx

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,28 @@ export function App(): React.ReactElement {
2121
}
2222

2323
export function ExampleComponent(): React.ReactElement {
24-
const { log } = useLog({ styles: { componentCSS: 'color: darkBlue;' } })
25-
const [state, setState] = useState<string | null>(null)
26-
const [anotherState, setAnotherState] = useState<string | null>(null)
24+
const { log } = useLog()
25+
const [currentState, setCurrentState] = useState<object>({})
2726

28-
log(state)
29-
log(anotherState, { styles: { componentCSS: 'color: darkRed;' } })
30-
31-
log(anotherState, {
32-
groupLabelRenderer: (type, name) => `Such a group! ${type} & ${name}`,
33-
})
27+
log(currentState)
3428

3529
useEffect(function setStateMount() {
36-
setState('onMount')
37-
setAnotherState('onMount')
30+
setCurrentState({ a: 'Test', b: 'Value', state: 'OnMount' })
3831

3932
setTimeout(function setStateChange1() {
40-
setState('onChange 1s')
33+
setCurrentState({ a: 'Test', b: 'Value', state: 'onChange 1s' })
4134
}, 1000)
4235

4336
setTimeout(function setStateChange2() {
44-
setState('onChange 2s')
37+
setCurrentState({ a: 'Test', b: 'Value', state: 'onChange 2s' })
4538
}, 2000)
4639

4740
return function setStateUnmount() {
48-
setState('onUnmount')
41+
setCurrentState({ a: 'Test', b: 'Value', state: 'onUnmount' })
4942
}
5043
}, [])
5144

52-
return <p>Test Component: {state}</p>
45+
return <p>Test Component: {JSON.stringify(currentState)}</p>
5346
}
5447

5548
const DefaultMeta: ComponentMeta<typeof App> = {

0 commit comments

Comments
 (0)