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>
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？
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.