GithubHelp home page GithubHelp logo

Comments (8)

lelandrichardson avatar lelandrichardson commented on April 28, 2024

I agree this would be a good addition. It should be easy enough to do if you want to PR it yourself, or else I will try and get to it soon! Should be just adding a way for the ReactWrapperComponent to conditionally unrender the mounted component through some state flag.

from enzyme.

pierluigi avatar pierluigi commented on April 28, 2024

Sounds cool! I will try to give it a whirl in the next days, but can't promise anything!

from enzyme.

pierluigi avatar pierluigi commented on April 28, 2024

I wonder if it would make sense to additionally perform an React.unmountComponentAtNode(wrapper.instance().getDOMNode());...

from enzyme.

lelandrichardson avatar lelandrichardson commented on April 28, 2024

in mount, the component you are rendering is actually wrapped by a parent component to allow for the setting of props, passing of context, etc. As a result, just conditionally rendering the child component should make the child component go through a full "unmount" lifecycle, so I don't think this would be necessary...

from enzyme.

lelandrichardson avatar lelandrichardson commented on April 28, 2024

Update: i'd like to add these methods, but we will need to wait until 2.0 to do so. These methods will not work without a DOM being present before requiring react since react's internals cache a reference to document.

from enzyme.

pierluigi avatar pierluigi commented on April 28, 2024

@lelandrichardson thanks for the update!

from enzyme.

lelandrichardson avatar lelandrichardson commented on April 28, 2024

This feature is now merged in. It will be in the next release.

from enzyme.

crisu83 avatar crisu83 commented on April 28, 2024

@lelandrichardson mind adding a link to the change to this issue? Thanks!

from enzyme.

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.