Git Product home page Git Product logo

Comments (4)

mpodlasin avatar mpodlasin commented on August 31, 2024 1

Aaah, it seems that it is React that puts defaultProps in actual props as early as possible, so there are here from the very beginning (when React.createElement is called):

https://github.com/facebook/react/blob/master/src/isomorphic/classic/element/ReactElement.js#L233

Could we consider getting rid of them by hand? For example check at some point if component has defaultProps and if it has, remove all of such values by hand from actual props object?

from enzyme-to-json.

adriantoine avatar adriantoine commented on August 31, 2024

Hi!

Thanks for raising the issue, that's an interesting one. I agree that A's snapshots shouldn't render B's internals, my only concern is to check how Enzyme wrappers work. If shallow(<A />).find('B').props() returns firstProps and secondProps, there's no way I can exclude secondProps from the snapshot as I'm only relying on Enzyme wrappers, not React internals, and it might be an Enzyme bug as I wouldn't expect props() to return default props anyway.

I'll have a look when I have time.

from enzyme-to-json.

mpodlasin avatar mpodlasin commented on August 31, 2024

I am up for tinkering myself and sending PR, if it's possible to provide fix. Just wanted to ask if you really consider it a bug.

from enzyme-to-json.

itsdouges avatar itsdouges commented on August 31, 2024

Hmm that's not good, I'll have look at fixing this.

from enzyme-to-json.

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.