在这里反应新手。我只想要一个简单的按钮,可以点击一下。但是当页面加载时会触发handleClick函数。
我发现了这个ReactJS - MouseClick gets triggered without a click,但是没有其他方法可以让它在没有创建额外课程的情况下工作吗?
这是我的代码:
class Login extends Component {
constructor(props, context) {
super(props, context);
this.state = {
open: false,
};
this.handleClick = this.handleClick.bind(this);
}
handleClick(){
console.log('The link was clicked.');
history.push("/zeitsammler/homepage");
}
render() {
return (
<MuiThemeProvider muiTheme={muiTheme}>
<div style={styles.container}>
<RaisedButton label="Login" style={btnStyle} onClick={this.handleClick()} />
</div>
</MuiThemeProvider>
);
}
}
答案 0 :(得分:1)
您没有将函数传递给import requests
import re
from bs4 import BeautifulSoup
html = requests.get("https://soundcloud.com/search/sounds?q=f& filter.created_at=last_year&filter.genre_or_tag=hip-hop%20%26%20rap")
soup = BeautifulSoup(html.text, 'html.parser')
for id in soup.findAll("a", {"class" : "sound_coverArt"}):
print (id.get('href'))
组件,而是执行它,将其更改为:
RaisedButton