I am trying to declare a variable "ratingVal" which is assigned a random no inside a map operator. I want to use the variable in the rating component and also display it on the screen. However I get an error
Parsing error: Unexpected token
What is the correct syntax for declaring a variable in this case?
renderProductsCardsList(products){ return products.map( (product, i) => let ratingVal = Math.floor(Math.random() * 5) + 1 <Rating initialRating={ratingVal} readonly></Rating> <div>{ratingVal}</div> ) }