How to change eslint settings to understand absolute import?

You need to use eslint-plugin-import: https://github.com/benmosher/eslint-plugin-import And configure your eslint settings in .eslintrc module.exports = { … “settings”: { “import/resolver”: { “node”: { “paths”: [“src”] } }, }, } Then, you can use import from src folder. Example, if you have src/components/MyComponent.jsx, you will write this: import MyComponent from ‘components/MyComponent.jsx’;

Add a long press event in React

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

What is the difference between Next.js and Create React App?

I’ve used both NextJs and CRA. Both these frameworks can be used to get started quickly and provide a good developer experience. However, both of these have use cases where either of them shines better. I’ll try to compare them based on some of these factors. Feel free to suggest edits with additional points or … Read more

How to add jsconfig.json to existing vscode project w/o breaking it

Setting NODE_PATH to resolve modules absolutely has been deprecated in favor of setting baseUrl in jsconfig.json (or tsconfig.json if you are using TypeScript) and will be removed in a future major release of create-react-app. This is a warning stating that the method you use for the absolute path in your project i.e. adding NODE_PATH in … Read more

Uninstalling Expo CLI

To completely uninstall expo cli On Windows The first step npm -g uninstall expo-cli –save (also yarn global remove expo-cli if you use yarn). Second cd %USERPROFILE% && rmdir /Q /S .expo On Mac OS Catalina The first step npm -g uninstall expo-cli –save (also yarn global remove expo-cli if you use yarn). Second cd … Read more

Problems with babel loader in react-create-app

Getting the same issue but given an hour on it get the solution When we run npm start then you got this kind of an error that is version related issues for this issue. Go to node_modules folder: Project->node_modules->react-scripts->package.json check the package.json file there you got : “babel-loader”: “8.0.4” first remove : babel-loader folder for … Read more

getting 404 for links with create-react-app deployed to github pages

Problem: URL gets evaluated on server side When you enter a new URL into address bar of the browser or refreshes the page, browser requests server (in this case GitHub pages server) for that URL. At this point, client side router (react-router) can’t take action as it is not yet loaded for that page. Now … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)