What is the difference between .env.local and .env.development.local?

Here’s the priority of the files for the development build and the production build: Dev.: (npm start): .env.development.local, .env.local, .env.development, .env Prod.: (npm run build): .env.production.local, .env.local, .env.production, .env If you ever want to use something in your local environment without being specific to the development build or the production build, you can add some … Read more

react long press event

I’ve created a codesandbox with a hook to handle long press and click. Basically, on mouse down, touch start events, a timer is created with setTimeout. When the provided time elapses, it triggers long press. On mouse up, mouse leave, touchend, etc, the timer is cleared. useLongPress.js import { useCallback, useRef, useState } from “react”; … Read more

Create-React-App build – “Uncaught SyntaxError: Unexpected token

Thanks this helped me a lot. Just wanting to add to this with an example from a Create-React-App project that had the same solution: I received the same error after deploying to heroku. Uncaught SyntaxError: Unexpected token < after serve -s build For me the problem was in the packages.json file. The “homepage” parameter i … Read more

Error while creating new React app (“You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0)”)

Try running npx clear-npx-cache to clear your npx cache and then running the npx create-react-app your-app command. Also have a look at this answer on clearing the cache. Additionally, it might be worth trying to force the latest version with: npx create-react-app@latest my-app –use-npm

How to get VSCode to show TypeScript errors for files *not* open in the editor?

As of 14.04.2020 There is an experimental feature in generally available VS Code to enable project wide problem reporting. Add the following to your settings.json: “typescript.tsserver.experimental.enableProjectDiagnostics”: true It is still an experimental feature (after few years of neglect), so it can be both overwhelming and underwhelming at the same time. Good thing is that it … Read more