I like to use useRoutes()
hook from
https://github.com/Paratron/hookrouter
but I have too many pages, and get lot of repeating code,
I try generate some areas, please help me write genRoutes()
function
Example code:
const pages = [{ name: 'aaa' }, { name: 'bbb' }, { name:'ccc' }]
const routes = genRoutes(pages)
console.log(routes)
> {
> '/aaa': () => <AaaPage />,
> '/bbb': () => <BbbPage />,
> '/ccc': () => <CccPage />
> }