Alan Jenshen
Alan Jenshen

Reputation: 3239

unexpected token using `` in jsx

<Link to=`/event/${event_id}?start=${startDate}&?end=${endDate}` target="_blank">
..content
</Link>

what's wrong with above snytax? I spot nothing wrong.

Upvotes: 0

Views: 75

Answers (2)

kurumkan
kurumkan

Reputation: 2725

In addition to @Tharaka 's answer you should add a property rel='noopener noreferrer' See here why

<Link to={`/event/${event_id}?start=${startDate}&?end=${endDate}`} target="_blank" rel='noopener noreferrer'>
..content
</Link>

It's considered as a best practice.

Upvotes: 0

Tharaka Wijebandara
Tharaka Wijebandara

Reputation: 8065

Warp your `` inside brackets since this is Javascript and JSX interprets Javascript only when it's between brackets.

<Link to={`/event/${event_id}?start=${startDate}&?end=${endDate}`} target="_blank">
..content
</Link>

Upvotes: 3

Related Questions