How to set language in moment js whole project-wide? - reactjs

I have a simple react project (npm, babel, es6). I would like to set language for WHOLE project. Not only for one file (what works). I checked a lot solution (ex. https://github.com/moment/moment/issues/1875#issuecomment-263220119) and it still doesn't work.
Does someone know how to solve this problem?

Related

Why are new react js files not saving?

I have noticed something about react recently. There are 3 react projects that I am working on. Everything is going well, but the problem is, I can't update new files that I just created in the project.
I am using Sanity.io in one of them and I have been trying to save the new components I just created but it's not working.
Initially I thought it had something to do with my codes, but I was surprised to experience it again in a MERN stack project I am working on. I can't save any new file I create.
Now there's another project I'm working on using Redux toolkit, I'm also experience the same issue.
I am using VS Code and I have reloaded the editor several times and its still not working.
At this point I assumed it was a VS code settings issue, so I switched one of the projects to Atom, and still the same thing.
What could be the cause of this? Is there a new feature or update in react that I don't know of? Or is it a file structure issue? I'm new to React so I don't know much.
Note, I didn't add codes to this question since I feel it much to do with my know of React in general than my codes.
I will appreciate every assistance I can get.

Adding Typescript to an existing React application one file at a time?

I've recently started working on a new project at work which has been utilizing React and JavaScript.
As someone who mainly used TypeScript in previous projects I've been struggling a bit with how loose everything is.
If I were able to, I would just convert the whole project to TypeScript however some of my coworkers aren't familiar with it.
My question is, lets say for example, I needed to add a new component somewhere on the page, would it work if I added TypeScript to the project with npm and had only one file as .tsx? Of course when building the project for production I would run TSC to compile it back into vanilla JS.
Also thought I should just point out I’m not looking to convert the whole project to TypeScript, just a few here and there.
Thanks!
Set up your project as if you were going to convert everything to typescript, make sure you have allowJs and checkJs set to true in your tsconfig file, make sure all variations of TS strict mode are off, then convert as many or as few (or even none) js files to ts.

vscode reformatting react js

I have VS Code and use it to edit my ReactJS application, along with several other people. I have the React Snippets extension installed but nothing else. It seems VS Code is reformatting my code, however, so that whenever I commit something with a small change, there are 20,000 diffs to review because of whitespace changes. Does anyone know why this is happening and how to stop it?

How do you build a webapp?

Probably a very stupid and easy question.
I'm new to React but I'm honestly new to software engineering in general.
I'm trying to build a web app, but I have no idea how.
I don't know anything about web apps, except that you should know a bit of HTML, CSS, JS.
Anyway, I went into this link https://reactjs.org/docs/create-a-new-react-app.html to create my first React app. I followed the instructions carefully and I now have this tab opened on pc:
I of course would like to edit the code and start making my app. But how? Where?
Where is this code written? Inside the directory that I used there is still nothing. I looked for "src" or "App.js" on my pc and found nothing. Where is it? Should I download anything else?
I'm a bit lost with this so any help would be appreciated.

Can typescript be used only in a few files in React project?

Given there is a React project that uses plain javascript, is there a way to use typescript partially only to define models?
So, lets say there are a few models that map to server responses, can only those be defined in typescript while the rest of the project remains in javascript.
If its possible, how to do it?
Typescript can definitely be implemented gradually into an existing JS project, and I know a few people who have gone through the process on some monoliths, it can be a really boring process but usually low risk.
I'll link you straight away to this:
https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html
The key is to understand what your goal is, and how to set everything up properly to accommodate for it, as you go it's as simple as toggling a few settings to unblock/check work as you go.
As for your question about some files being JS and some being TS, typescript handles pure JS perfectly fine, so you can switch every file to TS and even if it's pure js there won't be an issue :)
Have a read and if you need any more help on some specifics feel free to comment

Resources