'useSearchParams' from 'next/navigation' causing build to fail
Answered
Cão de Castro Laboreiro posted this in #help-forum
Cão de Castro LaboreiroOP
const searchParams = useSearchParams();
This line here is causing "next build" to fail with this error: Export encountered errors on the following paths:
/searchtest/page: /searchtest
It works normally with "next dev"
Is anyone else experiencing this?
using "next": "^14.1.0"
This line here is causing "next build" to fail with this error: Export encountered errors on the following paths:
/searchtest/page: /searchtest
It works normally with "next dev"
Is anyone else experiencing this?
using "next": "^14.1.0"
Answered by Ray
wrap this component with
if it is a page component, do this instead
Suspense.if it is a page component, do this instead
export default function Page({searchParams}) {}3 Replies
Cão de Castro LaboreiroOP
@Cão de Castro Laboreiro const searchParams = useSearchParams();
This line here is causing "next build" to fail with this error: Export encountered errors on the following paths:
/searchtest/page: /searchtest
It works normally with "next dev"
Is anyone else experiencing this?
using "next": "^14.1.0"
wrap this component with
if it is a page component, do this instead
Suspense.if it is a page component, do this instead
export default function Page({searchParams}) {}Answer
Cão de Castro LaboreiroOP
Thank you that did it in my case it was a Page component 😄