【发布时间】:2021-02-14 09:36:36
【问题描述】:
我已按照文档 https://nextjs.org/docs/advanced-features/debugging 中的 nextjs 调试指南进行操作
断点确实适用于功能组件,但从不在类中工作。 例如在这段代码中
import React from 'react'
class Index extends React.Component {
constructor(props) {
super(props)
this.state = {
number: 1
}
this.handeClick = this.handeClick.bind(this)
}
handeClick() {
// breakpoint here
debugger;
this.setState({number: this.state.number + 1})
}
render() {
return(
<div>
<button onClick={this.handeClick}>{'Click me!' + this.state.number}</button>
<Test></Test>
</div>
)
}
}
export default Index
断点根本不会被触发,知道为什么吗? 对不起,如果之前已经问过这个问题
【问题讨论】:
标签: debugging next.js breakpoints