Comments (4)
@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.
@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.
@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.
@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)
- `useModal` hook from the README not working HOT 1
- Empty default container appears on init HOT 2
- Animation not working while creating a custom hook HOT 5
- Documentation: tooltip/dropdown example HOT 2
- Swapping content in the portal closes it HOT 7
- Dont delete container, or provide a means to retain it HOT 6
- Demo gif HOT 2
- Using `esc` key within nested modal triggers all to be closed HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-cool-portal.