Skip to content

Instantly share code, notes, and snippets.

@richgcook
richgcook / menu.js
Created October 14, 2020 12:58 — forked from chaance/menu.js
Recursive menu component (React + Next.js)
import React, { Component } from 'react';
import Link from 'next/link';
import { uniqueId } from 'lodash';
import PropTypes from 'prop-types';
class Menu extends Component {
renderSubMenu = (children) => {
if (children && children.length > 0) {
return (
<ul className="menu__submenu">{this.renderMenuItems(children)}</ul>