Skip to content

Potential bug with wrapped components? #79

@tomkelsey

Description

@tomkelsey

Hi,

Using:

react-redux 7.2.6
react-router-dom 5.3.0
react-ssr-prepass 1.4.0

I've found if I export a component, "ComponentA" as:

withRouter(connect()(ComponentA)

I was getting the error:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

which appeared to originate from react-ssr-prepass.

I can "fix" this in my code by wrapping ComponentA differently:

connect()(withRouter(ComponentA))

I haven't got the capacity or knowledge to look into this further at the moment but wanted to highlight it in case it is an underlying bug that perhaps impacts others? (Apologies if this is just some weird quirk unique to my code!)

I did see an issue I thought might be related in the why-did-you-render repo - welldone-software/why-did-you-render#121

Where the fix appeared to be tweaking the order of the react component checks - welldone-software/why-did-you-render@983a18f

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