Git Product home page Git Product logo

Comments (6)

FlorianRappl avatar FlorianRappl commented on May 18, 2024

I'm confused. Every React component (I'm aware of) must be a function (either a class component or a FC).

Can you show the MWE? I tried, e.g., a class component and everything works without a flaw.

Just to be clear - if your code ends up in this part, you'd put in an object (as in typeof foo === 'object'). Glancing over react-redux I've also not seen an object returned, just (wrapped) functions. Maybe I'm missing something though.

from piral.

SantoJambit avatar SantoJambit commented on May 18, 2024

Here you go: https://github.com/SantoJambit/piral-mwe

from piral.

SantoJambit avatar SantoJambit commented on May 18, 2024

I've taken a deeper look and I think the issue comes with React.memo. I've updated the MWE to use React.memo instead of react-redux to reproduce the issue.

from piral.

SantoJambit avatar SantoJambit commented on May 18, 2024

Other react higher order components return objects as well: React.lazy, react.forwardRef.

The common part seems to be that an attribute $$typeof is present, with a value of Symbol(react.memo), Symbol(react.forward_ref), etc. respectively

from piral.

FlorianRappl avatar FlorianRappl commented on May 18, 2024

I see, thanks for figuring out a way to reproduce this. I think we can deal with the $$typeof special prop for the moment.

According to the type definitions we have:

    interface ExoticComponent<P = {}> {
        /**
         * **NOTE**: Exotic components are not callable.
         */
        (props: P): (ReactElement|null);
        readonly $$typeof: symbol;
    }

So looking if $$typeof is there and a symbol could be sufficient.

Hotfix with 0.8.1 incoming later today / tomorrow morning.

Thanks for the report! 🍻

from piral.

FlorianRappl avatar FlorianRappl commented on May 18, 2024

Landed in develop.

from piral.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.