Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const NestedMenuList = ({
classes,
menus,
selectedKey,
initialOpenKeys,
renderParent,
getParentProps,
renderChild,
getChildProps,
}) => {
const keyMap = React.useMemo(() => mapNestedPath(menus), [menus]);
const [iSelectedKey, setSelectedKey] = useStateBinding(selectedKey, '');
const getState = key => {
const selected = iSelectedKey === key;
const active = keyMap[key].includes(iSelectedKey) || selected;
return { selected, active };
};
const renderNestedList = level => (menu, idx, array) => {
const { subMenus } = menu;
const key = getKey(menu, idx);
const { active, selected } = getState(key);
const nextLevel = level + 1;
if (subMenus) {
return (