import React from 'react';
export default class UIColours extends React.Component {
displayName = 'UIColours'
render() {
const colours = ['black', 'red', 'white', 'orange', 'green', 'yellow', 'blue', 'darkblue', 'lilac', 'purple', 'darkPurple'];
return (
<div className="ui-colours-container row bg-white">
<div className="col-md-16 col-xs-16 light">
<div className="color-swatches">
{colours.map(function(colour, key) {
return (
<div key={key} className={'strong color-swatch bg-' + colour}>
<p>{colour}</p>
</div>
);
})}
</div>
</div>
</div>
);
}
}
12:26錯誤意外的函數表達式喜歡箭頭回調ESLint上array.map喜歡箭頭回調
我看了看地圖文檔並不能找到一個多參數的好例子。