Last active
June 8, 2023 06:43
-
-
Save svyatogor/fcdf460805134205b6993c3bcd7b24f5 to your computer and use it in GitHub Desktop.
RxJS-vs-Nanotore.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RxJS | |
const address$ = new BehaviourSubject<string>(undefined); | |
const signature$ = address$.pipe( | |
filter((address): address is string => !!address), | |
switchMap(async (address) => { | |
return await signWelcomeToken(address); | |
}), | |
catchError((err) => of(undefined)), | |
tap(store('signature')) | |
); | |
// nanostores | |
const address$ = atom<string>(); | |
const signature$ = computer(address$, (address) => { ... }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment