Reactjs 为什么react中的ref在这里为null?

Reactjs 为什么react中的ref在这里为null?,reactjs,popmotion,Reactjs,Popmotion,我一直在尝试popmotion pure,因为动画必须使用“ref”,我正在使用它。 这里,为什么ref(number)的值为null 有人能带我过去吗。 谢谢使用 const number = this.count.current; 而不是 const number = this.count.current.querySelector('#count'); 感谢您的编辑。。。!!!,我也打算这样做。在不讨论不这样做的原因的情况下,this.count.current相当于document.

我一直在尝试popmotion pure,因为动画必须使用“ref”,我正在使用它。
这里,为什么ref(number)的值为null

有人能带我过去吗。 谢谢使用

const number = this.count.current;
而不是

const number = this.count.current.querySelector('#count');

感谢您的编辑。。。!!!,我也打算这样做。在不讨论不这样做的原因的情况下,
this.count.current
相当于
document.querySelector(“#count”)
。您不需要
…current.querySelector(“#count”)是的,我是从下面的答案中得到的,实际上我是在遵循一个代码,这个人使用类似的东西。`const mouth=styler(this.catRef.current.querySelector(“#组合形状”)`我相信这是抓住了ref的一个子元素,IDIt解决了这个问题,是的,但我遵循了一个代码,用户使用类似这样的`const mouth=styler(this.catRef.current.querySelector(“#Combined Shape”)`
const number = this.count.current;
const number = this.count.current.querySelector('#count');