acdlite / acdlite/react-rx-component

Ref as an observable

Open
#5 17 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
83
Forks
4
PR merge metrics
No merged PRs in 30d

Description

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...

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.