Next.js development just feels faster to me
| Next.js, website
I spent yesterday (Saturday) working with Gatsby trying to get images displayed beside posts for another site I'm workin on. I managed to get it to work, but it was a pain. GraphQL is powerful, but it adds an extra layer of complexity for something that should be simple. I know the name of a pic I want when the page is being built (statically optimized); why can't I just use it?!
Using Next this is trivially easy:
<Image src={`/images/${pic}`} />
And here it is in a real loop where I'm rendering the data for my posts. In the frontmatter I've added a pic filename. (I've trimmed out some of the stuff that doesn't matter that much)
{allPostsData.map(({ id, date, title, description, pic }: PostData) => (
<li key={id}>
<Grid container spacing={1}>
<Grid item xs={2}>
<Image src={`/images/${pic}`} layout="responsive" quality={100} width={100} height={100}/>
</Grid>
<Grid item xs={10}>
<Link href={`/posts/${id}`}>
<a className={classes.link}><Typography variant="h5">{title}</Typography></a>
</Link>
<small>
<Date dateString={date as string} />
</small>
<p className={classes.description}>{description}</p>
</Grid>
</Grid>
</li>
))}
So in the end, Next.js just feels faster to me. And that's what matters to me as a hobbyist.