# How do I include p5-dom when importing from npm module/instance mode?

**URL:** <https://discourse.processing.org/t/how-do-i-include-p5-dom-when-importing-from-npm-module-instance-mode/7893>\
**Category:** Libraries\
**Created:** [January 28, 2019, 1:03am UTC](https://discourse.processing.org/t/how-do-i-include-p5-dom-when-importing-from-npm-module-instance-mode/7893 "2019-01-28T01:03:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidjj](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@davidjj](https://discourse.processing.org/u/davidjj)\
**Post date:** [January 28, 2019, 1:03am UTC](https://discourse.processing.org/t/how-do-i-include-p5-dom-when-importing-from-npm-module-instance-mode/7893/1 "2019-01-28T01:03:49Z")

</div>

The [instructions for including p5 libraries](https://p5js.org/libraries/) just says to include them in the head file.

However, I’m using it instance mode, for use with react, like:

```auto
    componentDidMount() {
        import("p5").then((p5) => {
            this.canvasPaint = new p5.default(sketch, this.refPaint.current);
            this.canvasPaint.doUpdate(
                this.props.controlPackage,
                this.props.statePackage,
                this.props.algorithms[this.props.selectedAlgo]
            );
        });
    }

```

I now want to add p5-dom so I can do video capture stuff. Is this possible?

There is [this github issue](https://github.com/processing/p5.js/issues/1996) - but it doesn’t really answer the question.

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [January 28, 2019, 5:26am UTC](https://discourse.processing.org/t/how-do-i-include-p5-dom-when-importing-from-npm-module-instance-mode/7893/2 "2019-01-28T05:26:46Z")

</div>

This article could be relevant, follow the links for p5.dom and p5.sound and see if it helps: [https://medium.com/front-end-weekly/the-building-of-threadd-react-three-js-p5-js-fc988e687686](https://medium.com/front-end-weekly/the-building-of-threadd-react-three-js-p5-js-fc988e687686)

Kf
