0

I would like to include a JS library into my react app. This is really frustrating to include a simple script tag. However I am a newbie in react so might be I am doing an incorrect way.

The library is a TradingView library downloaded from Github. For this I tried many method but I am failed to include. After inclusion the correct path goes to 404. Let me explain what I did:

  1. I put the library code in root folder and created a relative path and put the code in componentdidmount through document.createElement method.
  2. I created an hook and included that but its going to 404. Ref: link
  3. Tried with React-Helmet but same error. Ref: link

There are some more method I tried but none of them is working. Please help me out.

Sanjay Goswami
  • 822
  • 1
  • 16
  • 36
  • 1
    So, you're trying to include it by adding a ` – user56reinstatemonica8 Jun 23 '20 at 12:10
  • What TradingView library? You mean the private one or the public lightweight charts one? They are both included differently and if the private one you 're probably best asking them as people don't have access to it and its imported in a non-standard way. It also has instructions. Also please include the relevant bits of your code rather than describing them, and how your project is set up e.g. with create-react-app or? Adding TV involves a combination of putting files in your public/ dir and making a local linked or remote NPM package too. – Dominic Jun 23 '20 at 12:10
  • @user56reinstatemonica8 Thank you very much! You saved my day. I was struggling from past 3 days. – Sanjay Goswami Jun 23 '20 at 12:46

0 Answers0