The react project is used to call Wechat's jssdk interface and report 'wx' is not defined no-undef'.

problem description

In the

react project, when configuration information is injected into pages that need to use JS-SDK, the console prints: "wx" is not defined no-undef
what to do?

the environmental background of the problems and what methods you have tried

1. There are
2 js files introducing Wechat into the index.html interface, http://res.wx.qq.com/open/js/., or
3, and changing the location of Wechat"s js in the index.html interface. The error message is still the same

related codes

Wechat"s js file is introduced into the index.html interface

<body>
    ...
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript"></script>
</body>

introduce configuration into other component interfaces

class Invite extends Component {

  render() {
    ...
    wx.config({
      debug: true,
      appId: "**********", 
      timestamp: *****, 
      nonceStr: "*****", 
      signature: "***",
      jsApiList: ["***", "***"]
    });
    return (<div>...</div>)
   }

what result do you expect? What is the error message actually seen?

how to solve this problem?

The

react component is shielded from global variables. Referencing global variables requires window


window.wx.config () to try.
jweixin.js needs to be introduced before your js .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c1ddb4-333c6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c1ddb4-333c6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?