Problem dealing with const on .tsx pages
Unanswered
English Angora posted this in #help-forum
English AngoraOP
I have problems dealing with my page. I'm working with a page that use slugs as (main_page)/search/[...slug]/page.tsx and my homepage is located in (main_page)/page.tsx.
The thing is that when I go to my search page and loads and then goes back to my homepage the console shows errors like I'm trying to load const from "(main_page)/search/[...slug]/page.tsx"
(main_page)/search/[...slug]/page.tsx example
In errors show that it tries to cast buscarIdURLCategoria(number) and in this case receives 'img' as text. Any ideas?
Ty in advance! 😄
The thing is that when I go to my search page and loads and then goes back to my homepage the console shows errors like I'm trying to load const from "(main_page)/search/[...slug]/page.tsx"
(main_page)/search/[...slug]/page.tsx example
export default function page({ params }: any) {
const slug = params.slug;
const categoria = buscarIdURLCategoria(slug[0] !== undefined ? slug[0] : 0);
const subcategoria = slug[1] !== undefined ? slug[1] : 0;
const departamento = slug[2] !== undefined ? slug[2] : 0;
return (
<>
{`${categoria}`}
</>
)
}In errors show that it tries to cast buscarIdURLCategoria(number) and in this case receives 'img' as text. Any ideas?
Ty in advance! 😄