Dat.Gui produces multiple GUI's on hot reload in ReactJS

Oscar de la Hera Gomez
Two flowers that represent ReactJS and ThreeJS side by side. Beneath them sits the text "dat.gui Error: Multiple GUIs."

To ensure that only one dat.gui is seen on hot reload, destroy the gui in the componentWillUnmount event within a useEffect hook.

A screenshot of Chrome showing multiple, identical GUI's within a ThreeJS (3JS) scene.

In order to prevent ReactJS from generating multiple, identical GUI's on hot reload, you must destroy the GUI in the componentWillUnmount event within a useEffect hook.

To learn how to do this consult the tutorial below.

A screenshot of VSCode showing you how to update the useEffect function to setup the GUI and to destroy it to avoid errors on hot reload.

Looking to learn more about ReactJS and ThreeJS ?

Search our blog to find educational content on learning how to use ReactJS and ThreeJS.

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details