Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const CollapsibleMenuList = ({
initialExpanded,
subMenus,
renderWrapper,
getParentProps,
renderParent,
getChildProps,
renderChild,
collapseProps,
listClassName,
listProps,
}) => {
const [expanded, setExpanded] = useStateBinding(initialExpanded, false);
const elements = (
<>
{renderParent({
...getParentProps({ expanded }),
expanded,
onToggle: () => setExpanded(!expanded),
})}
{subMenus.map((data, idx, array) =>
renderChild(
getChildProps({ data, expanded, idx, array }),
idx,
array
)
)}