mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.63k stars 32.21k forks source link

using examples/material-cra-tailwind-ts as a template, code will run twice at load #37358

Closed shawhu closed 1 year ago

shawhu commented 1 year ago

Duplicates

Latest version

Steps to reproduce πŸ•Ή

Steps to repro

just copy examples/material-cra-tailwind-ts in this repo to a new folder, and make a small change

export default function App() {
    console.log("app start");  //<-added this line
    return (
       <Container maxWidth="sm">
       ....

and run it with npm in browser console, this line "app start" will output twice. if I use npx create-next-app@latest and I tested, it won't have the same behavior.

Current behavior 😯

it was printed twice

Expected behavior πŸ€”

it should only be output once

Context πŸ”¦

it affected me a lot...

Your environment 🌎

System: OS: Windows 10 10.0.19044 Binaries: Node: 18.16.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: Not Found Edge: Spartan (44.19041.1266.0), Chromium (113.0.1774.50) npmPackages: @emotion/react: latest => 11.11.0 @emotion/styled: latest => 11.11.0 @mui/base: 5.0.0-beta.1 @mui/core-downloads-tracker: 5.13.1 @mui/material: latest => 5.13.1 @mui/private-theming: 5.13.1 @mui/styled-engine: 5.12.3 @mui/system: 5.13.1 @mui/types: 7.2.4 @mui/utils: 5.13.1 @types/react: latest => 18.2.6 react: latest => 18.2.0 react-dom: latest => 18.2.0 typescript: latest => 4.9.5

oliviertassinari commented 1 year ago

This looks expected: https://react.dev/reference/react/StrictMode.

oliviertassinari commented 1 year ago

@samuelsycamore Actually, it doesn't make a lot of sense to have all these Create React App demos.

Screenshot 2023-05-22 at 01 04 20

https://github.com/mui/material-ui/tree/master/examples

How about we move the more specialized ones to Vite? https://npm-stat.com/charts.html?package=vite&package=react-scripts&package=next. Could you own this? https://github.com/mui/material-ui/issues/37367

shawhu commented 1 year ago

This looks expected: https://react.dev/reference/react/StrictMode.

never heard of this until today. thanks for pointing it out. i'm done. you guys continue...thanks!!