const StatelessComp = props => {
const anotherFunction = () => (
return <span><Button onClick={()=>props.incomingFunction}>Reset</Button></span>
)
return (
<TableHeaderColumn
className="tableHeader"
dataFortmat={anotherFunction}
>Restore</TableHeaderColumn>
};
为什么return
anotherFunction
中的Restore
时出现错误。我想在列上显示COMMON 0x20002b18 0x1 ./2_Programa/source/board.o
0x20002b18 BOARD_ctx
COMMON 0x20002b19 0x87 ./2_Programa/source/interface_objects.o
0x20002b19 GLB_appIntObjPropChangeFlags
0x20002b1a GLB_aioBLCommand
0x20002b65 GLB_aioDateTime
COMMON 0x20002ba0 0x31 ./2_Programa/source/objects.o
0x20002ba0 GLB_goFlags
*fill* 0x20002bd1 0x3
按钮。
答案 0 :(得分:1)
这是一个简洁的身体箭头功能。它必须包含表达式,而不是return
之类的任何语句。你应该写
const anotherFunction = () => (
<span><Button onClick={()=>props.incomingFunction}>Reset</Button></span>
);
或
const anotherFunction = () => {
return (
<span><Button onClick={()=>props.incomingFunction}>Reset</Button></span>
);
};