Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const NavItem: React.FC = ({ children, hasChildren = false }) => {
// @ts-ignore
const foundActive = !!Children.deepFind(children, ({ props }) => props.active)
const [isOpen, setIsOpen] = useState(foundActive && hasChildren)
const classes = `
rn-nav__list-item
${hasChildren ? 'has-children' : ''}
${isOpen ? 'is-open' : ''}
`
return (
<li data-testid="nav-item"> {
setIsOpen(hasChildren && !isOpen)
}}
></li>