Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a7617ce

Browse files
committed
docs: prettify
1 parent 7110251 commit a7617ce

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

apps/docs/docs/state/actions/actions.mdx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ Typically, Subjects are used to implement this functionality. However, in larger
4444

4545
That's where @rx-angular/state/actions comes in. It allows you to create observable action streams in a clean, maintainable, and less error-prone way, thus minimizing the amount of boilerplate code required.
4646

47-
4847
## RxAngular Actions
4948

5049
This package helps to reduce code used to create composable action streams.
@@ -153,7 +152,6 @@ class Component {
153152
// this.globalState.connectRefreshGenres(this.submittedSearchQuery$);
154153
}
155154
}
156-
157155
```
158156

159157
### Advanced usage
@@ -168,9 +166,7 @@ import { withLatestFrom, switchMap } from 'rxjs/operators';
168166
template: `
169167
<input (input)="searchInput($event?.target?.value)" /> Search for:
170168
{{ search$ | async }}<br />
171-
<button (click)="submitBtn()">
172-
Submit
173-
</button>
169+
<button (click)="submitBtn()">Submit</button>
174170
<br />
175171
<ul>
176172
<li *ngFor="let item of list$ | async">{{ item }}</li>
@@ -229,9 +225,7 @@ interface UiActions {
229225
template: `
230226
<input (input)="ui.searchInput($event)" /> Search for:
231227
{{ ui.search$ | async }}<br />
232-
<button (click)="ui.submitBtn()">
233-
Submit
234-
</button>
228+
<button (click)="ui.submitBtn()">Submit</button>
235229
<br />
236230
<ul>
237231
<li *ngFor="let item of list$ | async as list">{{ item }}</li>
@@ -240,7 +234,9 @@ interface UiActions {
240234
providers: [RxActionFactory],
241235
})
242236
export class Component {
243-
ui = this.factory.create({ searchInput: (e) => e.target ? e.target.value : '' });
237+
ui = this.factory.create({
238+
searchInput: (e) => (e.target ? e.target.value : ''),
239+
});
244240

245241
list$ = this.ui.submitBtn$.pipe(
246242
withLatestFrom(this.ui.search$),
@@ -249,7 +245,6 @@ export class Component {
249245

250246
constructor(private api: API, private factory: RxActionFactory<UiActions>) {}
251247
}
252-
253248
```
254249

255250
#### Using transforms
@@ -284,9 +279,7 @@ interface UiActions {
284279
template: `
285280
<input (input)="ui.searchInput($event)" /> Search for:
286281
{{ ui.searchInput$ | async }}<br />
287-
<button (click)="ui.submitBtn()">
288-
Submit
289-
</button>
282+
<button (click)="ui.submitBtn()">Submit</button>
290283
<br />
291284
<ul>
292285
<li *ngFor="let item of list$ | async">{{ item }}</li>
@@ -355,11 +348,7 @@ export class StateService extends RxState<State> {
355348

356349
// Optionally the reactive way
357350
connectRefreshGenres(genre$: Observable<string | number>): void {
358-
this.hold(
359-
genre$,
360-
genre => this.actions.refreshGenres(genre)
361-
);
351+
this.hold(genre$, (genre) => this.actions.refreshGenres(genre));
362352
}
363353
}
364-
365354
```

0 commit comments

Comments
 (0)