mardi 12 novembre 2019

How to pass if condition loop output to a variable in reactjs

I need help to solve this

    let someVar
        render(
          {
            this.props.someData.map((items) =>
                items.someotherData.map((item) =>
                   (item.data1> 5 && item.data2== "more") ? classNames({"classname1": true})
                       : (item.data1> 5 && item.data2== "less") ? classNames({"classname2": true})
                             : classNames({"classname3": true})
                                ))
          }

            <div className={someVar}>
            </div>
        )

I need my output of if loop to be pass to the variable I tried many method. Nothing worked. Please give the solution

Aucun commentaire:

Enregistrer un commentaire