Vlad Stan Vlad Stan - 1 year ago 439
Javascript Question

Why I get Error: assigning to rvalue?

I have a map() and I want to pass two params, one string and a function, like this code here:

{values.map( (workflow, totalWorkflow())=> {
return <WorkflowSingle key={workflow} workflow={workflow}/>

I got this error: Assigning to rvalue
Any idea why?

Answer Source

If your map function is the Array.prototype.map function, you passed wrong parameters to the function, map accepts callback and second optional parameter, like this:

arr.map(callback[, thisArg])

For your case:

values.map(function(x) {
    return <WorkflowSingle key = { x.workflow } workflow = { x.workflow } />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download