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.

2 Answers 2

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 Commented Feb 22, 2021 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 and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.