JSX syntax error?

Does this line of code have some sort of syntax error?
It shouldn’t be right???

<Link to={post.node.frontmatter.path}>Read More</Link>

The error is explained in the line above:

Adjacent JSX elements must be wrapped in an enclosing tag

This is because you are returning two elements simultaneously.

<div key={post.node.id}>

Simply wrap them into a div or a React.Fragment

1 Like