Categories
Mastering Development

Browser back does not work in reactjs application

New to reactjs and would like the browser back to go back to prior state. But it just seems to go back to prior page. package.json: “react”: “16.11.0”, “react-dom”: “16.11.0”, “react-loader-spinner”: “^3.1.5”, “react-promise-tracker”: “^2.1.0”, “react-redux”: “7.1.1”, “react-router”: “5.1.2”, “react-router-dom”: “5.1.2”, “react-scripts”: “^3.2.0”, “reactstrap”: “8.1.1”, “redux”: “4.0.4”, “redux-thunk”: “2.3.0”, index.tsx: import ‘bootstrap/dist/css/bootstrap.css’; import jQuery from “jquery”; […]

Categories
Development

Heroku Deployment Continues to Fail at “Pruning devDependencies” Step

I continue to have issues deploying to Heroku and I can’t find out what is going wrong for the life of me. The Heroku error log tells me this after it successfully builds my react app: —–> Caching build – node_modules —–> Pruning devDependencies npm ERR! Cannot read property ‘match’ of undefined Here is my […]

Categories
Development

Flash happening using React-beautiful-dnd and Cloud Firestore

I am developing a react-application that uses Firebase(Cloud Firestore), Redux and React-beautiful-DnD. Here is gif image Whenever I move ToDo-Task to another column, a flash happening. I assume the reasons are for calling multiple requests to Cloud Firestore at once. Here is the code I use to request update() to Cloud Firestore. Note: I used […]

Categories
Development

Unable to resolve module `./index.css` from `node_modules\antd-mobile\lib\button \style\css.js`

When I am running this command: expo build:android I am getting following errors: Unable to resolve module `./index.css` from `node_modules\antd-mobile\lib\button\style\css.js`: None of these files exist: * node_modules\antd-mobile\lib\button\style\index.css(.native|.ios.expo.ts|.na tive.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.js|.nat ive.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.native.ts |.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx| .ios.json|.native.json|.json|.ios.wasm|.native.wasm|.wasm) * node_modules\antd-mobile\lib\button\style\index.css\index(.native|.ios.expo. ts|.native.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.j s|.native.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.nat ive.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx |.jsx|.ios.json|.native.json|.json|.ios.wasm|.native.wasm|.wasm) Packager URL http://127.0.0.1:19001/node_modules\expo\AppEntry.bundle?dev=false& minify=true&hot=false&platform=ios returned unexpected code 500. Please open you r project in the Expo app and […]

Categories
Development React

Issue when pushing react app onto a Digital Ocean Ubuntu VPS

I built my first React (MERN) app based on a tutorial. It is using React Redux. I will post this there as well. I am using VS Code as IDE. The app works fine on my laptop When I push it onto a server (Digital Ocean Ubuntu VPS), running as an apache virtual host. I […]

Categories
Development

How to limit the scope of Jest mocked functions to a single test

I’m writing functional tests using Jest + Testing-Library/React. After days of head scratching, I figured out that when you use .mockResolvedValue(…) or .mockResolvedValueOnce(…) the scope of the mocking is not limited to that test… import React from “react”; import { render, waitForElement } from ‘@testing-library/react’; import ‘@testing-library/jest-dom/extend-expect’; import myApi from ‘../myApi’; jest.mock(‘../myApi’); // this will […]

Categories
Development Plugins

Got error: Plugin/Preset files are not allowed to export objects, only functions

I got this error while setup my react app using the webpack and babel. I try to change the version of babel but still getting the same error. I’m not getting where’s the problem. ERROR in ./src/index.jsx Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Plugin/Preset files are not allowed to export objects, only functions. In /home/arslan/Downloads/code/node_modules/babel-preset-es2015/lib/index.js […]

Categories
Development

multiple modules not found when deploying app – Ibm cloud

I am trying to deploy my app and it’s always failing onto IBM cloud CI/CD. The issue I have is that there are always some modules not found. The list of modules not found (occurs once every single time when the previous one is being installed) is as follows: depd merge-descriptors finalhandler debug encodeurl escape-html […]

Categories
Development

React webpack production build not booting

I have created a single page React app using React, webpack & react-router. The app is working fine locally without any errors or warnings. The problem is that once I create a production build and try to run the index.html file inside dist folder it is not booting my react app. package.json { “name”: “redux-simple-starter”, […]

Categories
Development

Hooks can only be called inside an body of functional component

I am using the useEffect hook in my function component while doing a fetch call but the problem is that it gives me error that: ‘Hooks can only be called inside the body of a function component’ But my component is functional only. And also If I am not using the hooks then memory leaks […]