badmfck-presenter
v1.0.9
Published
Wrapper for react-router-dom
Downloads
20
Maintainers
Readme
Presenter is a wraper over react-router-dom
Create sitemap, setup presenter, navigate throught sitemap.
Sitemap is an instance of array, filled with INavigationPoint
example:
const sitemap=[
{
name:"home",
id:"/",
sub:[
{name:"Contancts",id:"contacts"}
{name:"Products",id:"products",sub:[
{name:"Product Details",id:"prod",path:"prod/:id"}
]}
]
}
]
Use and update current site path
useCurrentPath();
Use and update menu (id: parent menu id)
useMenu(id?:string)
Create router from sitemap, Oufift - react component with
useCreateRouter=(sitemap:INavigationPoint[],Outfit:React.ReactElement,ErrorPage?:React.ReactElement,InnerErrorPage?:React.ReactElement)
Use presenter open access to navChange method - will change navigation by INavigationPoint or INavigationPoint.id
export const usePresenter=():IUsePresenter=>{ return { navChange:navigationChange, navDisable:navigationPointDisable, } }