acdlite / acdlite/react-rx-component

Ref as an observable

Offen
#5 17 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
83
Forks
4
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

This came up today trying to pass a `funcSubject` as a ref callback function. Because we're not actually subscribed when the ref callback fires (ie before `componentDidMount`), the value is just kind of lost.

Using a BehaviorSubject instead fixed the issue, but I thought I'd mention it for anyone else who ran into it.

Also I was wondering why you subscribe in componentDidMount and not the constructor? It seems like it potentially adds some unnecessary work. I imagine it's a "universal" thing but I don't have any experience with that...

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.