i'm trying to learn how dynamic routes work with NextJS and the thing is that in localhost (npm run dev
) works fine, but as soon as I push it to production in Netlify I get 404 error. Static pages are working, it just happends with dynamic routes. Here is an example of the code I have (is just a simple, static json to test how it works):
function ArticleListByCategory({articles}){
return(
<>
<h1>{JSON.stringify(articles)}</h1>
</>
)
}
export default ArticleListByCategory
export async function getServerSideProps(context){
const {params} = context
const {category} = params
return {
props:{
articles:{
"news":[
{
"name":"article1",
"category":category
}
]
}
}
}
}
Thanks in advance