Jump to content

JSX syntax error?

mrchow19910319

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>

304637321_ScreenShot2019-02-05at2_56_36PM.thumb.png.519e9ad9113299caf9f64f2a87da3b39.png

 

If it is not broken, let's fix till it is. 

Link to comment
Share on other sites

Link to post
Share on other sites

I could be wrong but everything needs to be wrapped in a div or another element, the map needs to return one element.

Link to comment
Share on other sites

Link to post
Share on other sites

^ correct.

 

You can do <>...</> as the message suggests (which is a shortcut for React.Fragment)

🙂

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×