1
我想有一個自定義的onClick事件發射任何時候我的一個被選中,但我無法讓step.id正確傳遞。我嘗試調度requestStep
時未定義stepId
。有什麼想法嗎?React自定義onClick事件與參數
var requestStepOnEnter = ({ stepId }) => {
store.dispatch(requestStep(stepId));
};
const ExperimentDetail = ({ steps }) => (
<div className="experiment-detail">
{
steps.map(step =>
<NavItem
eventKey={step.order}
key={step.id}
onClick= {() => requestStepOnEnter(stepId)}>
{step.order}
</NavItem>
)
}
</div>
);
export default ExperimentDetail;