jakoblind / webpack-autoconf

A tool to create frontend apps using webpack, Parcel or Snowpack
https://createapp.dev/
877 stars 78 forks source link

Switch to createRoot for react 18 #175

Open Pascal-So opened 2 years ago

Pascal-So commented 2 years ago

Thanks for creating this project, it's a real timesaver to not have to deal with all that webpack stuff myself!

When creating a project on createapp.dev with webpack and react selected, I currently get this generated code in src/index.js:

ReactDOM.render(<App name="Jane" />, mountNode);

When running with react 18.2.0 however (the selected version by the generated package.json), this code generates a warning in the js console , telling the user to switch to the createRoot function: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html#updates-to-client-rendering-apis

Also, I just noticed that the file extension on src/index.js is js instead of jsx, but when switching to typescript the extension is correctly set to tsx. I guess most people will use typescript anyway so this isn't a big issue.