Skip to content

Commit 70d2edb

Browse files
committed
docs(readme): refactor intro example
1 parent 45dd513 commit 70d2edb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ React Easy State is a practical state management library with two functions and
5252
import React from 'react';
5353
import { store, view } from '@risingstack/react-easy-state';
5454

55-
const counter = store({ num: 0 });
56-
const increment = () => counter.num++;
55+
const counter = store({
56+
num: 0,
57+
increment: () => counter.num++
58+
});
5759

5860
export default view(() => (
59-
<button onClick={increment}>{counter.num}</button>
61+
<button onClick={counter.increment}>{counter.num}</button>
6062
));
6163
```
6264

0 commit comments

Comments
 (0)