Category "reactjs"

How to apply to different bground color for each area in Chart.js

In react-chartjs-2 In Line chart every grid should have different background colors. Is this achievable with this library? This is how LineChart should looks:

react-google-login not calling onSuccess

In the following snippets I'm trying to implement google oauth into my webapp using npm react-google-login. When I try to sign-in, the popup appears, I select o

Why Web3 .GetReserves() is spamming my console?

My code below gets the data correctly; however, there is one problem where when I try to get the reserves of a token. It spams the data over and over again to t

How to upload an image in React JS?

<div className="mb-1"> Image <span className="font-css top">*</span> <div className=""> <input type="file"

Environment variable undefined error in node.js

server.js const express = require('express'); const dotenv = require('dotenv'); const error = require('./middleware/errorMiddlewareHandler'); const usersRo

Updating an object with setState in React

Is it at all possible to update object's properties with setState? Something like: this.state = { jasper: { name: 'jasper', age: 28 }, } I have tried:

How to test for document being undefined with RTL?

I have the following react hook which brings focus to a given ref and on unmount returns the focus to the previously focused element. export default function u

Curved view shape in React Native

I wanna replicate the following layout, where there are 2 views (one with white background and the other one with a blue background). The issue is, I can't rep

How to set a default value in react-select

I have an issue using react-select. I use redux form and I've made my react-select component compatible with redux form. Here is the code: const MySelect = pro

REACT - Express : fetching data doesn't work on reload when user connected

I've deploy my first app using React with Nodejs/Express/MongoDB but I'm running through a bug I couldn't find any solution, so I'm coming here to find some hel

In React Login component Firebase Login signup is working but when I am trying to send a reset password Link then is Not sending to email

In React Login component Firebase login signup is working but when I am trying to send a reset password Link then it is not working. there is no getting email v

Types of parameters 'event' and 'event' are incompatible

I have a project, which is an employee monitoring project, and it has several components, and among these components is having a group of buttons together. I ha

React-toastify toasts don't close

I have a react app and I use react-toastify to prompt for certain messages. However, whenever I click the x on the toasts they don't close. They do, however, cl

React Router v4 routes not working

I am relatively new to reacts and I'm trying to figure out how to get React router to work. I've got a super simple test app that looks like this: import React

Jest: "Directory in the roots[0] option was not found"

I am trying to set up monorepo to run all of its Jest tests at once. In each package, I'm using react-app-rewired to get Babel to transpile code imported from o

ESLint - Component should be written as a pure function (react prefer/stateless function)

ESLint is giving me this error on a react project. Component should be written as a pure function (react prefer/stateless function) It points to the first lin

How can I align vertically and horizontally my fields for each column?

How do I align my columns horizontally and vertically aligned in each column? Here the picture (whatI have/whatI want): export default function App() {

Error 404 when you refresh a Next.js page

I am getting this error whenever I try to refresh a routed page in my small Next.js app.

Whats the best way to update an object in an array in ReactJS?

If you have an array as part of your state, and that array contains objects, whats an easy way to update the state with a change to one of those objects? Examp

Pagination in React/Typescript

So I am trying to achieve pagination functionality. Here I have crypto API and a table where data lies, the thing I want to achieve is displaying 10 items per