在survivaljs代码示例中,我遇到了一个函数,其主体用括号括起来:
export default () => (
<ul>
{notes.map(note =>
//some code
)}
</ul>
)
Run Code Online (Sandbox Code Playgroud)
MDN 是这样解释的:
Run Code Online (Sandbox Code Playgroud)// Parenthesize the body of function to return an object literal expression: params => ({foo: bar})
试图弄清楚这在现实世界用例中的实际含义。欢迎使用汽车类比 (;