3 ms·
You’re complicating the two elements; They are interactive without javascript. Your answer is listening to native “open” change event, then reading this value a
by piskerpan 4y ago
You’re complicating the two elements; They are interactive without javascript. Your answer is listening to native “open” change event, then reading this value and setting it back to the attribute via JSX. If the event happens at the wrong time, you’re possibly reading the previous value (closed) and setting it back to the details element.
I’d either avoid details in your case or see how others are using it.
- greggman3 4y agoI am not, as I need to state of the details to be settable. That's the whole mo of react, that all UI state is under your control and has a single source of truth. For example you want a tree of files, give the user a search function, and want to expand/collapse any subtreee that contains/does not contain a result. Details is a collapsable building block. that's it.