sscaff1 / hookrouter

The flexible, and fast router for react that is entirely based on hooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useRoutes returns null

dawnmessier opened this issue · comments

These docs say to import hook-router, however the project won't build with that. So I changed it to import hookrouter-react. The project builds with this change, however useRoutes always returns null. Is this a bug?

import { useRoutes } from 'hookrouter-react';
const routes = {
    '/app/': () => <></>,
    '/app/activity': () => <Activity />
};

const Root = () => {
    const routeResult = useRoutes(routes);
    return routeResult || <div>No results</div>;
}

EDIT: This is a nested route issue. Apparently, only the last partition of the url is handled out of the box