在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML/ 在redux里面怎么傳遞類似this.handleClickRow這種鉤子函數(shù)

在redux里面怎么傳遞類似this.handleClickRow這種鉤子函數(shù)

this.handleClickRow = this.handleClickRow.bind(this)

不用 redux 我可以這么傳遞

<BasicInformation
    basicInformationData = { basicInformationData }
    submitTaskId = { this.submitTaskId }
    getTaskId = { _self.state.selectTaskId }
    isAdmin = { _self.state.isAdmin }
/>

現(xiàn)在改用redux包住組件,不知道怎么傳遞了

BasicInformationContainer.js

import React from 'react';
import { connect } from 'react-redux';
import BasicInformation from '../components/index';
import { toggleToChange } from '../../../../../actions';
import { DifferentLabelsFilters } from '../../../../../actions';

const getDifferent = (todos, filter) => {

    let return_todos = '';

    switch (filter) {
        case DifferentLabelsFilters.SHOW_ALL:
            return_todos = todos;
            console.log('BasicInformationContainer return_to_dos = ', return_todos)
            return return_todos;
        case DifferentLabelsFilters.SHOW_COMPLETED:

            return todos.filter(t => t.completed)
        case DifferentLabelsFilters.SHOW_ACTIVE:
            return todos.filter(t => !t.completed)
        default:
            throw new Error('Unknown filter: ' + filter)
    }
}

const showAdmin = (showAdmin) => {
    return showAdmin;
}

const mapStateToProps = state => {

    console.log('BasicInformationContainer state = ')
    return {
        showDifferent: getDifferent(state.showDifferent, state.differentLabelsFilter),
    }
}

const mapDispatchToPropsReview = (dispatch) => {

    const _self = this;

    //console.log('BasicInformationContainer mapDispatchToPropsReview ===', _self.props)

    //console.log('******************* dispatch ===', dispatch)

    return {
        toggleToChangeBasicInformation: id => dispatch(toggleToChange(id)),
        toggleToSubmitTaskId: id => _self.props.submitTaskId(id),
    }
};

export default connect(
    mapStateToProps,
    mapDispatchToPropsReview
)(BasicInformation);
回答
編輯回答
清夢(mèng)

一樣的辦法呀,沒(méi)什么區(qū)別。

redux只是管理了state,對(duì)組件并沒(méi)有什么特殊要求。

2018年2月15日 10:53