【发布时间】:2019-08-10 14:38:24
【问题描述】:
我是 React 的新手,如果这太基本了,请见谅。
我正在尝试在我的应用中添加一个按钮以将其重定向到 Spotify。
到目前为止,这就是我正在尝试的方式。
class Spotify extends Component {
constructor () {
super()
this.handleClick = this.handleClick.bind(this)
}
handleClick () {
console.log('Success!')
}
render () {
return (
<div className='button__container'>
<button className='button' onClick={this.handleClick}>
Link your Spotify account
</button>
</div>
)
}
}
export default Spotify;
现在,将上述按钮链接到:
<a href="http://localhost:8888"></a>
【问题讨论】:
-
您有什么特殊原因不能将您的 localhost:8888"></a> 添加到您的