ご閲覧いただきまして、ありがとうございます。
親コンポーネントにある関数を、2階層下の子コンポーネントで使っているのですが
下記のエラーが発生してしまい、通りません。
_this4.props._handleExport is not a function
直前でコンソールを開いてみたのですが、取れているようにも見えるのですが・・・。
_handleExport: ƒ (ref) arguments: (...) caller: (...) length: 1 name: "" prototype: {constructor: ƒ} __proto__: ƒ ()
ソースコード
src/components/PrimaryItem.js
JavaScript
1・・・ 2export default class PrimaryItem extends Component { 3 render() { 4 return ( 5 <Stage 6 ref={ref => { 7 this.props._handleExport(ref); 8 }} 9 > 10 </Stage> 11 ); 12 } 13}
src/components/PrimaryContainer.js
JavaScript
1import PrimaryItem from "./PrimaryItem"; 2・・・ 3<PrimaryContainer 4 _handleExport={this._handleExport} 5/> 6・・・
src/App.js
JavaScript
1import PrimaryItem from "./components/PrimaryContainer"; 2・・・ 3export default class App extends component { 4 _handleExport = ref => { 5 if (ref) { 6 this.refStage = ref; 7 } 8 }; 9 render() { 10 return( 11・・・ 12 <PrimaryContainer 13 _handleExport={this._handleExport} 14 /> 15・・・ 16 ) 17 } 18}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。