Closed oliviertassinari closed 2 weeks ago
Hi, would you like to create a PR?
Hi, would you like to create a PR?
Hey @ilyastorunn! I can do that, but go ahead if you have one ready.
Hi @oliviertassinari, var might have been used because the code was written in an environment where ES6 (let and const) was not supported, or it’s older code.
I can pick this up if you like?
Summary
We use
var
:https://github.com/mui/material-ui/blob/9f4b846be96ee18733b6bd77eba2f54b1ceb9b04/packages/mui-system/src/InitColorSchemeScript/InitColorSchemeScript.tsx#L95
but this seems confusing. Why not
let
? For example, https://github.com/pacocoursey/next-themes/blob/bf0c5a45eaf6fb2b336a6b93840e4ec572bc08c8/next-themes/src/script.ts#L14 who use modern syntax.Using let over var seems to have two benefits:
var
.Motivation
I was confused by this looking into #43416.