NathanKleekamp / Render-Menu-from-Tree

An experiment to render a menu with React stored in a tree-like data structure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup

$ docker-compose up

Visit http://localhost:3000

What we're building

This thought experiment uses a tree-like data structure to store the data for the menu. It then walks the tree and selects the React component to correctly render the content based on a node's type.

screenshot of generated menu

Most interesting files

Other thoughts

By moving the onClick handlers to another file and referencing them only by name (as a string), it would be easier to write tests. Also, that would mean that the entire tree could be serialized as JSON. That could be handy, for example, if there was a toggle to change the keyboard shortcuts to accommodate different OSs, for example.

About

An experiment to render a menu with React stored in a tree-like data structure


Languages

Language:JavaScript 77.7%Language:CSS 11.4%Language:HTML 10.1%Language:Dockerfile 0.7%