Skip to content

Commit b6b7291

Browse files
committed
docs: update docs
1 parent 0e28608 commit b6b7291

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function TodosComponent() {
8383
```
8484

8585
## useComponentEffects
86-
To use an effect we first need to create it by using the `createEffect` function:
86+
To use an `effect` we first need to create it by using the `createEffect` function:
8787

8888
```ts
8989
import { createEffect } from '@ngneat/react-rxjs';
@@ -96,7 +96,9 @@ export const searchTodoEffect = createEffect((searchTerm$: Observable<string>) =
9696
});
9797
```
9898

99-
This function takes a callback function which is passed an `Observable` parameter and returns an `Observable`. Now we can register it in our component, and call it when we need:
99+
The `createEffect` function takes a `callback` function which is passed an `Observable` parameter and returns an `Observable`.
100+
101+
Now we can register the effect in our component, and call it when we need:
100102

101103
```ts
102104
import { useComponentEffects$ } from '@ngneat/react-rxjs';
@@ -107,7 +109,19 @@ function SearchComponent() {
107109
return <input onChange={({ target: { value } }) => searchTodo(value)} />
108110
}
109111
```
110-
Every time the `effect` is called, the value is pushed into that `Observable`. We can pass multiple effects to `useComponentEffects`.
112+
113+
Every time the `effect` is called, its value is pushed into that `Observable`.
114+
115+
116+
We can also register multiple effects:
117+
118+
```ts
119+
function FooComponent() {
120+
const [addTodo, updateTodo, deleteTodo] = useComponentEffects([addTodoEffect, updateTodoEffect, deleteTodoEffect]);
121+
122+
return ...
123+
}
124+
```
111125

112126

113-
<div>Icons made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>
127+
<div>Icons made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div>

0 commit comments

Comments
 (0)