Javascript 如何使用可选参数绑定ReactJS中的函数?

Javascript 如何使用可选参数绑定ReactJS中的函数?,javascript,reactjs,ecmascript-6,bind,flowtype,Javascript,Reactjs,Ecmascript 6,Bind,Flowtype,假设我需要在React组件构造函数中绑定一个函数,因为它将作为道具传递给子组件 该函数有一个可选参数,如果未指定,则该参数具有默认值。绑定这种函数的语法是什么 假设我有一个带有可选参数的函数,如果未指定任何参数,则该函数有一个默认值: _handleEdit(isTwoWay: boolean = false):void {} 在声明中这样做的语法是什么 class Component extends React.Component<void, void, void> {

假设我需要在React组件构造函数中绑定一个函数,因为它将作为道具传递给子组件

该函数有一个可选参数,如果未指定,则该参数具有默认值。绑定这种函数的语法是什么

假设我有一个带有可选参数的函数,如果未指定任何参数,则该函数有一个默认值:

_handleEdit(isTwoWay: boolean = false):void {}
在声明中这样做的语法是什么

class Component extends React.Component<void, void, void> {

    _handleEdit: (isTwoWay: boolean = false) => void;

    constructor(): void {
        super();

        this._handleEdit = this._handleEdit.bind(this);
    }

    _handleEdit(isTwoWay: boolean = false): void {
    }

}
类组件扩展React.Component{
_handleEdit:(isTwoWay:boolean=false)=>void;
构造函数():void{
超级();
this.\u handleEdit=this.\u handleEdit.bind(this);
}
_handleEdit(isTwoWay:boolean=false):无效{
}
}
此语法未通过流检查或生成:
_handleEdit:(isTwoWay:boolean=false)=>void

请将代码张贴在父类设置的
位置。这是一种原型方法吗?这会影响答案。它不是原型,而是真实的方法。我指的是类
prototype
method,不是口语意义。原型方法和构造函数中定义的方法之间存在差异。
\u handleEdit:(isTwoWay?:boolean)=>void应该工作这看起来像一个bug。为什么类属性注释不能工作,而其他两个却不能?