const App = props => {
let alerts = () => {
alert(props.time)
}
let is = {color:props.color? "red" : "blue"}
return <div onClick={alerts} style={is}>{props.time},</div>;
}
let Apps = ()=>{
return <div>
{arrTime.map(item => <App key={item.time} time={item.time} color={item.color} />)}
</div>
}
原文:https://www.cnblogs.com/js-liqian/p/11747638.html