-
Notifications
You must be signed in to change notification settings - Fork 248
Conversation
When doing a build react-helmet is loading js files once in the head and once in the body. React helmet manages the head and thus this script toComponent() should be in the head.
Hi. Is this really creating an issue? Can you give more details about this? |
Did you check if there are options in react-helmet about that? |
react-helmet is specifically for managing the head, so there are no options for that. Also, sometimes you want to load scripts in the head. For example, a script that has logic, which sometimes redirects to another page. For example: optimizely. Another example would be new relic, which you want to get accurate page load timings. Now, with that said there are a number of other react libraries such as react-async-script or ReactScriptLoader that can be used to asynchronously load external scripts in the body. But, these can easily be added as part of the template by the developer as needed. |
This change worked for me. My opinion is this commit sounds good as a temporary iterative step because currently the scripts are added to the head and the body. Then open a new enhancement issue to investigate body only script options. I had a quick look and React-Helmet appears hard coded to the headElement as far as I could tell. headElement being set here. |
I am ok with this changes if it brings more problem than it's supposed to solves. Can you fix the relevant tests please? If you need some help reach us on gitter |
Done. |
Thanks! I will release this as a minor (not a patch) as some people might get unexpected results. |
When doing a build react-helmet is loading js files once in the head and once in the body. React helmet manages the head and thus this script toComponent() should be in the head.