create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

not able to use defer in a dynamically generated script tag

Open amitanshusahu opened this issue 3 years ago • 0 comments

Describe the bug : can't use defer in a script tag

using defer = true produces in the script tag same goes with async also image output : 👇 image

Did you try recovering your dependencies?

ans) there is nothing wrong with my dependencies

Which terms did you search for in User Guide?

ans ) i searched for

how to use defer in dynamically generated script tag in react

i got no solution for this

Environment

ans ) no output , i am using the latest react version

Steps to reproduce

i need to make a api call after a script tag is dynamically generated

  1. using let script = documet.createElement("script") , i created a script tag
  2. enabled defer for the tag ( script.defer = true ) 3.the output was not as expected

Expected behavior

ans ) creating a script with defer and async i.e "

Actual behavior

ans ) it creates a script with defer = " " and async = " " i.e "

amitanshusahu avatar Sep 29 '22 13:09 amitanshusahu