Skip to content

bind HOC should provide a proper type for RefObject<> #6

@PinkyJie

Description

@PinkyJie

If we have a form component like this:

class UnconnectedFormComponent extends React.Component<FormComponentProps>{...}

export const FormComponent = bind(FormComponentProps)(UnconnectedFormComponent)

When we use it, we want to pass a ref:

// Note the "any" here
public ref: React.RefObject<any> = React.createRef();
<FormComponenrt ref={ref} />

The actual reference type should be BoundComponentInstance, but if we use this, there will be type mismatch issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions