Skip to content

Instantly share code, notes, and snippets.

@Xananax
Created October 21, 2015 14:18
Show Gist options
  • Save Xananax/cdf02648db67c4183bd1 to your computer and use it in GitHub Desktop.
Save Xananax/cdf02648db67c4183bd1 to your computer and use it in GitHub Desktop.
function renderNodes({name,directories,files}){
return [<tr>{name}</tr>]
.concat(directories.map(renderNodes))
.concat(files.map(file=><tr>{file}</tr>))
}
class Root extends Component{
render(){
return (<table>
<thead>{this.props.name}</thead>
<tbody>
{renderNodes(this.props)}
</tbody>
</table>)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment