What is webpack and does it matter if my React files are .jsx instead of .js?


I’m Maya, and I have been programming for a few months now and done a few projects in VanillaJS. Recently I have started to learn React. My vscode isn’t recognizing jsx so I have switched the file type from .js to .jsx. Is this fine to do and is it also ok to push .jsx to GitHub because I’m a bit worried that the job recruiters don’t like it.

My other question is what is webpack, and when should I start using it? Is it something that I should worry about now?

Hey Maya,

nice to meet you! :wave:

You can use both js and jsx.

I think the Webpack Homepage is the best starting point to learn more about webpack and what it does.

How do you currently add React to your projects?

1 Like

I do npx create-react-app my-app

when you have a look at package.json, you can see that your project is using react-scripts.

When you have a look at the react-scripts source code, you can see that it uses Webpack under the hood.

So you are already using Webpack, e.g. when you run npm start, your project is using the Webpack development server.

So if I do npx create-react-app I don’t have to worry about Webpack, right?

Yes, in general you don’t have to worry about webpack.

The only exception would be running npm run eject, if you would not be happy with the default create-react-app setup. But this is probably nothing you have to worry about as a beginner.