react-hot-loader
を使用すると、私に奇妙な問題が発生します。 React反応ホットローダーを使用したときの最大呼び出しスタックサイズを超えました
Uncaught RangeError: Maximum call stack size exceeded at PatientEdit.__test__REACT_HOT_LOADER__
class PatientEdit extends React.Component {
test =() => {
return 123
}
constructor(props) {
super(props)
}
static propTypes = {
}
render() {
return (
<div>{this.test()}</div>)
}
}
がスローされます。しかし以下の3がドキュメントとして追跡されたすべての権利
// A
class PatientEdit extends React.Component {
test(){
return 123
}
constructor(props) {
super(props)
}
static propTypes = {}
render() {
return (
<div>{this.test()}</div>)
}
}
// B
class PatientEdit extends React.Component {
test(){
return 123
}
constructor(props) {
super(props)
}
static propTypes = {}
render() {
return (
<div>{this.test()}</div>)
}
}
// C
class PatientEdit extends React.Component {
test =() => {
return 123
}
static propTypes = {}
render() {
return (
<div>{this.test()}</div>)
}
}
ローダー構成されていると言う:.babelrc
は以下のように、ファイルの前babel-polyfill
とreact-hot-loader/patch
を追加エントリ
// .babelrc
{
"presets": [["env", {"modules": false}], "react", "stage-1"],
"plugins": [
"react-hot-loader/babel",
"transform-decorators-legacy",
"transform-flow-strip-types",
"transform-object-assign",
"transform-runtime",
"typecheck",
"react-css-modules"
]
}
最初は奇妙な振る舞いに衝撃を受け、エラースタックを無視しました。今度はreact-hot-loader
のメカニズムと歓迎詳細な説明を見て私の時間
「A」と「B」は動作しますが、「C」は動作しません。 – Chris
this.test.bind(this)を試しましたか? – rrd
現在のコードには全く問題はありません。再レンダリングの原因となるテスト機能で他に何もしていないと確信していますか? –