0

Take the following example.

const predefinedFonts = { Lato: [], Montserrat: [] };
const [fonts, setFonts] = useState(() => predefinedFonts);

From my best understanding, the result of fonts ends up just being predefinedFonts.

So what's the difference? useState could have just been this to begin with, with no arrow function.

const [fonts, setFonts] = useState(predefinedFonts);
Drew Reese
  • 165,259
  • 14
  • 153
  • 181
chron1cle
  • 63
  • 5

0 Answers0