0

I am trying to pass plainid and id as a parameter in query string in URL.

{planid = item.planId}
        { id =item.id}
<td><a href="https://tasks.office.com/credentinfotech.com/en-GB/Home/Planner#/plantaskboard? planId=`${planid}`&taskId=`${id}`" >{item.title}</a></td>
        <td>{moment(item.startDateTime).format('MM/DD/YYYY ')}</td>
        <td>{moment(item.dueDateTime).format('MM/DD/YYYY')}</td>

I am new to React suggest any way so that I can pass variables in query string in the .tsx file.

0

Use this:

<a href={"https://tasks.office.com/credentinfotech.com/en-GB/Home/Planner#/plantaskboard?planId=" + planid + "&taskId=" + id}></a>
1
  • Hi @abhishek, did you try this? does this answers your question? If Yes, Please Upvote(^) and accept as an Answer as it will help others to find the correct answer easily. It will also remove this question from "Unanswered questions" list Feb 22 at 6:28
0

You can use template string like this:

   <a href={`https://tasks.office.com/credentinfotech.com/en-GB/Home/Planner#/plantaskboard?planId=${planid}&taskId=${id}`}></a>

References: Template literals (Template strings)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.