As with any virtual DOM based framework, you need to check if React has rendered the DOM (or any updates to it) before you initialize GridStack or call its methods. As a basic example, check this component's mounted
hook.
If your app requires more complex render logic than the inline template in `addWidget`, consider makeWidget to let React deal with DOM rendering.