2

I used the following line to style a material UI grid in my react project.

gridTemplateColumns: Repeat("auto-fit", minmax("300px", "1fr"))

I get this error "ReferenceError: minmax is not defined".

It looks React knows the repeat CSS function but not the minmax function. I could not figure out why. Any help would be appreciated.

ADG
  • 21
  • 1

1 Answers1

2

You're currently trying to call functions and pass strings into them, but that's incorrect. gridTemplateColumns needs to be a string, not a function call. The string happens to look like function calls, but if any code needs to be run, the browser will do that, not you.

style={{
  gridTemplateColumns: "repeat(auto-fit, minmax(300px, 1fr))"
}}
Nicholas Tower
  • 72,740
  • 7
  • 86
  • 98
  • You are right. That is what I should do when styling an element using inline styling. How would I do it if I were styling a material UI component? I am trying to apply the style to a material UI Grid component. – ADG Sep 27 '21 at 09:40