How to reference a third-party js? in es6

recently added Wechat login function, the project is created through create-react-app, similar to
1 in the following figure, how should js be referenced? Can the sections of
2 and js be written directly into Component?


  1. you can directly introduce
  2. into the entrance index.html as mentioned above.
  3. can also use the npm package scriptjs to directly reference a third party js, in component, such as:
import $script from 'scriptjs'

$script('xxx.js', function () {
  console.log('load xxx.js success')
})

export default class Catalogue extends Component {
...
}

can be introduced directly into index.html.


Wechat has a npm package for wx-jssdk, which is loaded into the project, import, directly and then use it according to the documentation

.
Menu