0
if (propValue.indexOf('column') === 0) {
        output[`& > .${gridClasses.item}`] = {
          maxWidth: 'none',
        };
      }

Can anyone please explain this code?

lsr
  • 264
  • 1
  • 10
  • 2
    if `propValue` starts with `"column"`, add a key called `"& > ." + gridClasses.item` to the `output` object with the value `{ maxWidth: .. }` – adiga Jun 04 '21 at 06:13
  • Thanks for the reply!! And what does this operator "& > ." mean?? – lsr Jun 04 '21 at 06:16
  • It's not an operator. It's just a string. It's using [Template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) to add a variable to the string. If `gridClasses.item` value is `"header"`, it creates the object `output = { "& > .header" : { maxWidth: 'none' } }`. It's creating an object with CSS selectors as keys like https://stackoverflow.com/a/36167545/3082296 – adiga Jun 04 '21 at 06:20

0 Answers0