201flaviosilva-labs / 201flaviosilva-labs/utilidades-react
React - Recursive Component
Open
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Example: https://www.olioapps.com/blog/react-recursion/
````jsx
import React from "react";
export default function Branch({ title = "title", data }) {
function renderBranch(key, index) {
const item = data[key];
if (Array.isArray(item)) {
if (item.length > 0) return ;
return null;
} else if (typeof item === "object") {
return ;
} else {
return (
{key}: {item}
);
}
}
return (
{title}
{
Object.keys(data).map((key, index) => renderBranch(key, index))
}
);
}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.