0

Hi I am trying to concatenate form field names and refs like this and returning the jsx

<select className="lp-country" id="lp-country" name = 'country'{i} ref = 'country'{i} >

where i is the index of the loop. I am getting unexpected token error.

Code screenshot: https://www.screencast.com/t/8QILiZaBGMM

Error screenshot: https://www.screencast.com/t/ITZPH6BVT

1 Answer 1

2

String interpolation is not used correctly there.

replace

name = 'country'{i} 

with

name = {`country${i}`}

Same for ref.

Sign up to request clarification or add additional context in comments.

1 Comment

perfect! glad I could help : - )

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.