Answers
CustomersPage
will render when the path is/customers
.
ErrorPage
will render when the path is /products
.
- The path could be
path="customers/:customerId"
. - It is likely that the
Outlet
component has not been added toSettingsPage
. - Both will work, but
NavLink
is better because it enables items to be styled when active. - The route parameter referenced should be
userId
:const params = useParams<{userId: string}>();
const id = params.userId;
- Hooks must be called at the top level of function components. Also, the
useSearchParams
hook doesn’t directly have aget
method. Here’s the corrected code:const [searchParams] = useSearchParams();
function getFilteredCustomers() {
const criteria = searchParams.get('search');
...
}
- The lazy component must be nested inside a
Suspense
component as follows:{
path: '/special',
element: (
<Suspense...