Skip to content

Commit

Permalink
feat(Docs): update README
Browse files Browse the repository at this point in the history
  • Loading branch information
foreleven committed Aug 13, 2019
1 parent 22f9921 commit 508c3db
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ npm install stated-bean
- Small size: ~3kb (zipped ~1kb)
- Written in TypeScript

## API

`@StatedBean() @Stated() @PostProvided`

- @StatedBean - the stated class.
- @Stated - the stated fields.
- @PostProvided - the method with @PostProvided will be invoked in `useEffect(..., [])`

`<StatedBeanProvider types={[CounterModel]}>`

The `StatedBeanProvider` is responsible for creating an instance of the stated bean and throwing an event after capturing its data changes.

`useStatedBean(CounterModel)`

The `useStatedBean` will find an instance of the stated bean from the context and listen for its data changes to trigger the re-rendering of the current component.

## Usage

### Online Example
Expand Down Expand Up @@ -96,18 +112,6 @@ function CounterDisplay() {

</details>

## API

decorators

- @StatedBean - the stated class.
- @Stated - the stated fields.
- @PostProvided - the method with @PostProvided will be invoked in `useEffect()`

`StatedBeanProvider`

`useStatedBean`

## License

MIT

0 comments on commit 508c3db

Please sign in to comment.