Expose setActiveKey for Collapse
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
I have a series of nested Collapse elements which takes 3 seconds to render. I want to programmatically set the activeKey. If i use state props, there is a long delay while the whole nested series re-renders. I tried to save a ref to the Collapse element, but it does not help because, there is no function to set the active key (even though setActiveKey is present in the Collapse class in modules).
This should be a very simple addition to the API surface as the underlying function is already there (and used on user click).
What does the proposed API look like?
CollapseRef.setActiveKey([stringKey]);
Collapse already has and uses the method internally, I just want it exposed on the CollapseRef.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Dynamically Open and Close antd / react Collapse Component
The Collapse react component has setActiveKey (and uses it on user click) but it is not exposed to the Collapse Node reference. Is...
Read more >Collapse - Bootstrap
Click the buttons below to show and hide another element via class changes: .collapse hides content .collapsing is applied during transitions .collapse.show ...
Read more >Introduction — Blender Manual
As such, they typically have no attributes, and are controlled by settings exposed in separate sections of the Properties.
Read more >TODO.txt - external/github.com/ocornut/imgui - Git at Google
window: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon? - window: expose contents size.
Read more >imgui/TODO.txt at 4649967112f71b149cc4c8e67c28d815d5edf0e9 ...
window: double-clicking on title bar to minimize isn't consistent, perhaps move to single-click on left-most collapse icon? - window: expose contents size.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t think we will expose a API like this, it’s an anti-pattern in React.
@afc163, I know you are super busy, but I’d like you to understand the use case a bit better. Even if you stay with your decision…
If I control activeKey via state and props, then collapsing a single top level element, takes over 3 seconds to render. If I am not controlling activeKey, clicking to collapse an element is instant (no re-render).
I now did a terribly ugly workaround:
I would much prefer to use:
For me, it would be great if you could simply acknowledge that 3 seconds to open or close a collapse element is far too long. If you have a less ugly workaround - or way to use state+props without rerendering, even better… If you could reconsider exposing setActiveKey, that would be amazing.
Thanks.