const deviceType = [
{
smartphoneName: 'Precision 5530',
deviceType: 'smartphone',
},
{
smartphoneName: 'MS-7A34',
deviceType: 'computer',
},
{
smartphoneName: 'MS-7A34',
deviceType: 'computer',
},
]
{deviceType .map((item, index) => (
<DeviceItem
key={`${item}_${index}`}
smartphoneName={item.smartphoneName}
deviceType={item.deviceType}
/>
))}
const wrapper = document.querySelector('.entry')
const oldImg = wrapper.getAttribute('style')
const newImg = wrapper.getAttribute('data-bg')
window.addEventListener(`resize`, event => {
if (window.innerWidth <= 500) {
wrapper.setAttribute('style', newImg)
} else {
wrapper.setAttribute('style', oldImg)
}
}, false);