I cannot understand why in the arrow functions we do not need to wrap the literal of arrow function in the ({})
braces, instead of in this example the literal just wrapped in the single ()
braces. Why? I had surfed the internet to find an answer on it, but it failed.
And also why we put the arguments in double braces ({})
, instead of just ()
?
const FilterLink = ({ filter, children }) => (
<NavLink
to={filter === 'SHOW_ALL' ? '/' : `/${ filter }`}
activeStyle={ {
textDecoration: 'none',
color: 'black'
}}
>
{children}
</NavLink>
)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…