Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I have a problem with react and Visual Studio Code when save

When I save in Visual Studio code using React, it breaks everything.

import './index.css';
import App from './App';
import FileInput from './FileComponents/FileInput';
import Highlights from './FileComponents/Highlights';
import AllFiles from './FileComponents/AllFiles';
import Header from './FileComponents/Header';
import FileUploadMenu from './FileComponents/FileUploadMenu';
import * as serviceWorker from './serviceWorker';

ReactDOM.render( < App / > , document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: [redacted]
serviceWorker.unregister();

enter image description here

like image 473
Alex Alberto Robaina Avatar asked Jun 05 '26 00:06

Alex Alberto Robaina


1 Answers

VS Code determines file's language by its extension. In your case, it is javascript, but should be javascriptreact.

Either:
- change all file extensions from .js to .jsx,
- or configure file association settings in your user/workspace settings:
enter image description here

like image 184
cezn Avatar answered Jun 07 '26 13:06

cezn