Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在功能组件中使用流检查道具,以便我可以直接使用道具变量?_Javascript_Reactjs_Types_Flowtype - Fatal编程技术网

Javascript 如何在功能组件中使用流检查道具,以便我可以直接使用道具变量?

Javascript 如何在功能组件中使用流检查道具,以便我可以直接使用道具变量?,javascript,reactjs,types,flowtype,Javascript,Reactjs,Types,Flowtype,我想直接使用props作为变量,而不在它们前面添加props对象 Smth类似:onChange={handleChange},而不是onChange={props.handleChange} type Props = { handleChange: Function, values: Object, t: Function } function RadioList(props: Props) { r

我想直接使用props作为变量,而不在它们前面添加
props
对象

Smth类似:
onChange={handleChange}
,而不是
onChange={props.handleChange}

   type Props = {
        handleChange: Function,
        values: Object,
        t: Function
    }
    
    function RadioList(props: Props) {
        return (
            <div className={css.radioList}>
                <RadioField
                    isFormik
                    name="some_name"
                    label={t('some_label')}
                    onChange={handleChange}
                    className={css.listFilterRadio}
                />
            </div>);
    }
类型道具={
handleChange:功能,
值:对象,
t:功能
}
职能放射科医生(道具:道具){
返回(
);
}
使用

函数放射科医生({handleChange}){
返回(
);
}
使用

函数放射科医生({handleChange}){
返回(
);
}
类型道具={
handleChange:功能,
值:对象,
t:功能
}
职能放射科医生(道具:道具){
const{handleChange}=props;//解构props
const{radioList,listFilterRadio}=css;//如果您从某处获得css变量,也可以对其进行破坏
返回(
);
}
类型道具={
handleChange:功能,
值:对象,
t:功能
}
职能放射科医生(道具:道具){
const{handleChange}=props;//解构props
const{radioList,listFilterRadio}=css;//如果您从某处获得css变量,也可以对其进行破坏
返回(
);
}
    function RadioList({handleChange}) {
    return (
        <div className={css.radioList}>
            <RadioField
                isFormik
                name="some_name"
                label={t('some_label')}
                onChange={handleChange}
                className={css.listFilterRadio}
            />
        </div>);
}
  type Props = {
        handleChange: Function,
        values: Object,
        t: Function
    }
    
    function RadioList(props: Props) {
        const { handleChange } = props; //  destructuring the props
        const { radioList, listFilterRadio } = css; // you can destrcture your css varible too if you are getting it from somewhere
        return (
            <div className={radioList}>
                <RadioField
                    isFormik
                    name="some_name"
                    label={t('some_label')}
                    onChange={handleChange}
                    className={listFilterRadio}
                />
            </div>);
    }