I get this when trying to destructure and pass on a property using the app page router.
It works sometimes, but changing between the param paths will give me this error in this file:
/src/app/[floor]/page.tsx
'use client'
import useSWR from 'swr'
import SearchInput from '@/components/Search/SearchInput'
import FloorPlan from '@/components/FloorPlan/FloorPlan'
interface Props {
params: { floor: string }
}
const fetcher = (url: URL) => fetch(url).then(res => res.json())
const Home = async ({ params: { floor } }: Props) => {
const { data, error } = useSWR('/api/staticdata', fetcher)
// Handle the error state
if (error) return <div>Failed to load</div>
// Handle the loading state
if (!data) return <div>Loading...</div>
return(
<main>
<SearchInput data={data} />
<FloorPlan floor={floor} />
</main>
)
}
export default Home