Nitin Agarwal Nitin Agarwal - 1 year ago 131
Javascript Question

Javascript ES6 Difference between ()=>() and ()=>{}

I have seen a code something like while learning React

const LinkCell = ({rowIndex, data, col, ...props}) => (
<Cell {...props}>
<a href="#">{data.getObjectAt(rowIndex)[col]}</a>

Also, so far I thought that in ES6 function shorthand is

let sum = (a, b)=>{
return a + b;

How the first one is different from the second one ?

Answer Source

with the ()=> () syntax imagine if there was an implicit return statment e.g. () => {return ()}

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download