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> }