acdlite / acdlite/react-rx-component

Ref as an observable

未关闭
#5 17 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
83
派生
4
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。