gpt4 book ai didi

javascript - 不变违规 : Usage Issue for npm Library

转载 作者:行者123 更新时间:2023-12-02 14:17:24 25 4
gpt4 key购买 nike

我正在尝试使用 npm site 中找到的react-google-login ,但我遇到了一些问题。错误是

bundle.js:3104 Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method ofLogin.

bundle.js:3104 Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method ofLogin

这可能是因为使用问题。我也可能没有正确导入。非常感谢任何帮助。

var React = require('react')
var GoogleLogin = require('react-google-login')
var Login = React.createClass({
responseGoogle(e){
console.log("response",e)
},
render:function(){
return <div>
<GoogleLogin
clientId="xxxxxxxxxxx-yyyyyyyyyy.apps.googleusercontent.com"
buttonText="Login"
callback={this.responseGoogle} />
</div>
},
});
module.exports = Login;

~

这很可能调用了不需要的函数或类。我一直在使用 require 并且我不熟悉 import 。任何关于 future 找出正确语法的正确方法的建议或注释也受到高度赞赏。

最佳答案

你尝试过吗:

var GoogleLogin = require('react-google-login').default

关于javascript - 不变违规 : Usage Issue for npm Library,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38916181/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com