Skip to content

Accordion doesn't re-render when defaultIndex changed #8191

Closed Answered by amandaguthrie
zhondori asked this question in General
Discussion options

You must be logged in to vote

defaultIndex is used to set the initial state for which accordion items are open.
index is used to set currently expanded accordion items and will re-render the component.

The Accordion onChange function provides an expandedIndex. The expandedIndex is the current accordion item index(es), which is a number if allowMultiple is off, or an array of numbers if allowMultiple is on. This can be used to store the changing index values to handle the index programmatically.

-1 means all items are closed, and other numeric values are the index(es) of open accordion item(s).

Hope this helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@zhondori
Comment options

Answer selected by zhondori
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants