Giter Site home page Giter Site logo

Comments (4)

wellyshen avatar wellyshen commented on May 12, 2024

@killthekitten Sorry to confuse you. This hook will automatically creates the container element for you if it doesn't exist. I have refine the documentation in the latest version, thank you.

from react-cool-portal.

killthekitten avatar killthekitten commented on May 12, 2024

@wellyshen thanks for the update, looks better now. However, it feels like this behavior should be separated.

If the container is present most of the time, but not always, it might ruin the UI. Imagine a dynamic containerId, or just making an error in code. The user will see the "default" container created by the library, rather than a styled and tested container that was supposed to be there.

from react-cool-portal.

wellyshen avatar wellyshen commented on May 12, 2024

@killthekitten Sorry I donโ€™t fully understand your concerning. Currently, the library will creates the container element only when needed and removes the element once itโ€™s not used. For the overall mechanism, which part can we improve?

from react-cool-portal.

killthekitten avatar killthekitten commented on May 12, 2024

@wellyshen I'm concerned that providing a custom containerId can render a new element when it wasn't intended.

I can see three scenarios of using this:

  • There's no element with containerId. I want to create it automatically, as a sibling to root.
  • There is an element with such an id, and I want to use it.
  • There's no element, but I expect it to be there. I don't want a new element to be created, and would prefer an error to be thrown rather then silently create a new element.

The library covers the first two cases, but not the third one.

I would suggest an option to enable/disable rendering the container automatically, i.e. createContainer. The naming isn't great tho.

from react-cool-portal.

Related Issues (9)

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.