0

I want to run a script in react and need to include variables to the script. I use this script-reader: https://louisrli.github.io/blog/2020/06/04/react-dynamic-script-hook/#.YKvsrOtCRB0 . It works fine without variables but I don't know where I can include the variables properly. This is how it works with javascript:

<script>
    var option = {
        style: "something"
    }
</script>
<script async src="sourcescript"></script>

Do you have an idea how I could include this option var?

devGuy
  • 113
  • 1
  • 9
  • 1
    Looks like a duplicate of https://stackoverflow.com/questions/2190801/passing-parameters-to-javascript-files – lironer May 24 '21 at 18:32
  • Does this answer your question? [Passing parameters to JavaScript files](https://stackoverflow.com/questions/2190801/passing-parameters-to-javascript-files) – Bhojendra Rauniyar May 24 '21 at 18:47
  • I don't think that your answer provides a solution to my question because I use react to make my script work and I don't know at which point and how I can include the variables. I think this is completely different... – devGuy May 24 '21 at 18:51

0 Answers0