Error with plot.js when useing Plot in React (creator.js throw an error - the ref of this is null)

I use plot in my react project, but when i try the demo , i got an error(Cannot read properties of null (reading ‘ownerDocument’)) in create.js.

the object of this is null.

Can any one help me? Thank you!

There’s a simple example for using Plot with React here: Getting started | Observable Plot

I’m not quite sure about the context of the first code you posted … in general though this in JavaScript has kind of a troubled history and it’s usually difficult to follow what it refers to unless you’re using very well-tread patterns.