You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* callback - a function which accepts params as `prevState`, `currentState`, `methodName`. It is triggered when the state of `target` changes.
152
+
* target - model or agent, which you want to listen the state change from.
153
+
* methods - optional, if you don't need it, the effect `callback` will triggerd immediately when using `useAgentEffect`, if you add them, only the state changes caused by these methods can trigger the effect `callback`.
154
+
155
+
returns void.
156
+
157
+
Go to [tutorial](/tutorial?id=use-agent-effect) to see, how to use it.
Copy file name to clipboardExpand all lines: docs/tutorial.md
+130-1Lines changed: 130 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -856,4 +856,133 @@ export default function NewFeatures() {
856
856
857
857
`Agents`baseonasamemodelobjectcanupdatestatesynchronously. Usingthisfeatureof`agent-reducer`canmakeyourcodemoresimple. AnduseAPI [useAgentSelector](/api?id=useagentselector) and [useAgentMethods](/api?id=useagentmethods) canmakeyourcomponentrendermorelesswith`agent-reducer`modelsharing.
858
858
859
-
Youcandomorethingstomakeasearchpagemodelbetter.
859
+
Youcandomorethingstomakeasearchpagemodelbetter.
860
+
861
+
## Useagenteffect
862
+
863
+
IfyouneedeffectAPIof`agent-reducer`directly, youcanreferto [document](https://filefoxper.github.io/agent-reducer/#/guides?id=effect), if you are more interest to [effect decorator](https://filefoxper.github.io/agent-reducer/#/guides?id=effect-decorator) you can take look at the guids of agent-reducer. But, here we just introduce API [useAgentEffect](/api?id=useagenteffect) .
0 commit comments