File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,29 @@ class ContactsList extends React.Component {
3232 < div >
3333 < h3 > My Contacts</ h3 >
3434 < h4 > Recently fetched contacts</ h4 >
35+ < pre >
36+ < code >
37+ { `
38+ recentContacts$ = myContacts$.pipe(startWith(null as Contact[] | null));
39+ <Subscribe>{recentContacts$.pipe(map(this.renderList))}</Subscribe>
40+ ` . trim ( ) }
41+ </ code >
42+ </ pre >
3543 < Subscribe > { this . recentContacts$ . pipe ( map ( this . renderList ) ) } </ Subscribe >
44+
3645 < h4 > All contacts</ h4 >
46+ < pre >
47+ < code >
48+ { `
49+ allContacts$ = myContacts$.pipe(
50+ scan((acc, contacts) => {
51+ return [...(acc || []), ...(contacts || [])];
52+ })
53+ );
54+ <Subscribe>{allContacts$.pipe(map(this.renderList))}</Subscribe>
55+ ` . trim ( ) }
56+ </ code >
57+ </ pre >
3758 < Subscribe > { this . allContacts$ . pipe ( map ( this . renderList ) ) } </ Subscribe >
3859 </ div >
3960 ) ;
You can’t perform that action at this time.
0 commit comments