Within my React component, I am receiving a values object with attributes like:
{gridColumn: '1 / 3', gridRow: '2 / 5', gridArea: 'header'}
I apply these values to the component's style as follows:
this.cell.style.setProperty('grid-area', values.gridArea);
this.cell.style.setProperty('grid-column', values.gridColumn);
this.cell.style.setProperty('grid-row', values.gridRow);
The issue arises when using grid-column and grid-row properties, as they are condensed into shorthand notation 'grid-area: 2 / 1 / 5 / 3' by the browser, leading to an overwrite of the grid-area style.
This problem persists even if I try setting the styles in a loop:
for (let prop in values) {
this.cell.style[prop] = values[prop];
};
Are there more effective approaches to handle this situation?