Skip to content

not able to use defer in a dynamically generated script tag #12751

@amitanshusahu

Description

@amitanshusahu

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

using defer = true produces <script defer=" "> 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
"<script defer async> </script>

Actual behavior

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions