I am doing a personal project in react.js but at this moment I am trying to write clean code. Could exist a way to write shorter this code in two lines? or something like that. I tried to make objects of arrays like
const apps= {app_name:['Maps','Meet'], position:['0 2323', '0 2323'}
but It does not work
const apps = [
{
app_name: 'Maps',
position: '0 -828px'
},
{
app_name: 'Gmail',
position: '0 -483px'
},
{
app_name: 'Calendar',
position: '0 -2553px'
},
{
app_name: 'Drive',
position: '0 -2277px'
}
];
There is not a way to rewrite it in a more shorter way in order to make the map's function works?
{apps.map((el, i) =>
<li className='items'>
<a className='link'>
<div className='img_box'>
<span className='img'
style={ { backgroundPosition: el.position } }></span>
</div>
<span className='app_name'>{el.app_name}</span>
</a>
</li>
)}