Skip to content

HoC形式下的一个获取内部组件props的问题 #14

Description

@mooncakelmn

(按回车直接提交了。。。)
就如README中的最后关于HoC的例子:https://github.com/ecomfe/react-track#%E9%AB%98%E9%98%B6%E7%BB%84%E4%BB%B6-1

const track = action => {
    const options = {
        eventPropName: 'on' + action[0].toUpperCase() + action.slice(1),
        category: 'navigation',
        action: action,
        label: null // 此处label期望值应为NavItem的name prop
    };
    
    return trackEvent(options);
};

我们会期望label的值为 NavItem的其中一个prop: name。但实际并不能取到,所以这个HoC的应用场景是有局限的?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions