React, accessing a var from a script in a component

前端 未结 3 1483
旧时难觅i
旧时难觅i 2021-01-24 17:46

I have been trying to import an external library (google Maps) in order to use it in a React component

index.html file

3条回答
  •  闹比i
    闹比i (楼主)
    2021-01-24 18:12

    The error is because the google api is not loaded before your React Component is loading.

    Place the script tag for google in the header, before loading your react scripts.

    
        
    
                                     
                  
提交回复
热议问题