Reputation: 701
I want to write something like this in my Gatsbyjs Link tag:
<Link to=`/${this.props.latestPost.node.slug}`>Click Here</Link>
but it's not working, and my code looks like this:
Is there some way I could use a javascript expression inside the 'to' property? I want the slug to be dynamic, as the Link tag is for a 'recent posts' set of links, that will regularly update.
Upvotes: 1
Views: 176
Reputation: 18556
You need to escape it as Javascript:
<Link to={`/${this.props.latestPost.node.slug}`}>Click Here</Link>
Upvotes: 1