The document.querySelector(’#id’) is null in js. I’m guessing that the error occurred because I imported js files that were executed before DashRenderer().
// The scripts oreder in HTML
// <script src="/assets/js/nav-menu.js?m=1623147446.3624363"></script>
// <script src="/_dash-component-suites/dash_renderer/dash_renderer.v1_9_1m1622237833.dev.js"></script>
// <script id="_dash-renderer" type="application/javascript">var renderer = new DashRenderer();</script>
var renderer = new DashRenderer();
So my question is how can I put the js (in assets) after the render event to make sure my statement is no longer null?
I have used it a few times myself without encountering any issues. If you intend to get help on how to proceed, you should be more specific about your issue than “not works very well”.
It is probably loaded before (all files in the assets folder are) and after (via the import component) react loads. If possible, the easiest would be just to load the js code via an external url. Alternatively, you can use the flask server to serve the js code.