not able to set proper values into state in react

tempData.map(i =>
      selectedLine = {
        "LineItemID": i.LineItemId,
        "ReconTemplateTypeID": i.ReconTemplateTypeId
      }
    )

this.setState({ selectObject: [...this.state.selectObject, selectedLine] }, 
              function () { this.checkMultipleSelectedFlag() })

tempData contains data out of which, I want to store lineitemid and templateid in a variable and then setState into the state object. I tried writing this.setState inside map function but it is throwing error. Any idea how can i achieve this?