Use container defined in local javascript

hello all,
I want to use a component in dash like this

app.layout = html.Div(id=“container”,className = “amap-container”, style ={“width”:“1600px”,“height”:“800px”})

And the component is a container defined in local javascript.
I use something like this

var map = new AMap.Map('container', {
center: [116.397428, 39.90923],

The container is not be loaded.
But when I customerize the web with app.index_string like this

app.index_string = '''
<!DOCTYPE html>
    #container {
      width: 100%;
      height: 100%;
       <div>My Custom header</div>
        <div id="container"> </div>
        <div>My Custom footer</div>

then the container can be loaded.
So how can I use html.Div(id=“container”) and load the container?