0.1.2 • Published 2 years ago

react-route-tree v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

A simple tree component with nodes acting as route link :

Install

npm i react-route-tree

Usage

import Tree from './components/react-route-tree/src/Tree' import { BrowserRouter as Router, Routes, Route } from "react-router-dom";

function App() { let treeData = [ { "name": "Router", "to": "/router", "children": [ { "name": "Overview", "to": "/overview" }, { "name": "Example", "to": "/example", "children": { "name": "Simple Routing Demo", "to": "/simpleRoute" }, { "name": "Nested Route Demo", "to": "/nestedRoute" } } ] }, { "name": "Create Ref", "to": "/createRef", "children": [ { "name": "Overview", "to": "/overview" }, { "name": "Example", "to": "/example", "children" : { "name" : "Simple referncing - .createRef", "to" : "/createRef" }, { "name" : "Forward Ref", "to" : "/forwardRef" }, { "name" : "Callback refs", "to" : "/callbackRef" } } ] } ];
return (

<div className="App">
  <Router>
    <Tree data = {treeData}/>
</Router>
</div>

); }

export default App;

License

react-route-tree is released under the MIT license.

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago