Middle+
Do you have experience with Next.js? Tell us about your experience.
sobes.tech AI
Answer from AI
Yes, I have experience working with Next.js. I used this framework to create server-rendered React applications, which helped improve SEO and speed up page loading.
In my projects, I implemented:
- Static site generation (SSG) using
getStaticPropsandgetStaticPathsfor blogs and catalogs. - Server-side rendering (SSR) via
getServerSidePropsfor dynamic content. - Using Next.js API routes to create backend endpoints within the application.
- Image optimization with the built-in
next/imagecomponent.
Example of using getStaticProps:
export async function getStaticProps() {
const res = await fetch('https://api.example.com/posts');
const posts = await res.json();
return { props: { posts } };
}
function Blog({ posts }) {
return (
<ul>
{posts.map(post => <li key={post.id}>{post.title}</li>)}
</ul>
);
}
export default Blog;