From 508c3db3f65c5911155df19bce70bb79cdefd07c Mon Sep 17 00:00:00 2001 From: foreleven Date: Tue, 13 Aug 2019 19:43:48 +0800 Subject: [PATCH] feat(Docs): update README --- README.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e399686bf..9e755156c 100644 --- a/README.md +++ b/README.md @@ -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(..., [])` + +`` + +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 @@ -96,18 +112,6 @@ function CounterDisplay() { -## API - -decorators - -- @StatedBean - the stated class. -- @Stated - the stated fields. -- @PostProvided - the method with @PostProvided will be invoked in `useEffect()` - -`StatedBeanProvider` - -`useStatedBean` - ## License MIT