Category "reactjs"

jest.config is being ignored

I have the following in my jest.config.js module.exports = { preset: 'ts-jest/presets/js-with-ts', testEnvironment: 'jsdom' }; but it's being ignored w

React + Typescript - Refs typing errors

I have seen many other questions with the same problem as mine, and I have tried all solutions, but it is not working. I have a form with many inputs, which I h

Should I wrap every prop with useCallback or useMemo, when to use this hooks?

With react hooks now available should I in case of functional components wrap every function passed with props with useCallback and every other props value with

Nextjs shallow routing for tabs?

Have a tabs component which work perfectly with the router.query state useEffect(() => { let found = false; if (currentTab !== 'leads') {

React and Tailwind CSS: dynamically generated classes are not being applied

I'm just learning React and Tailwind CSS and had a strange experience with CSS grid using Tailwind classes. I've made the buttons for a calculator, with the las

How to overlay content on react leaflet (z-index problem)

Really tried to not post this as I've seen similar questions but I'm not able to display anything over the react leaflet library after reading things online. T

setting up lint-staged for jest

I have to try to set up a husky with lint-staged. Initially, I was trying to set up like the following but that does not work. "lint-staged": { "*.js": [

React-select & React-hook-form Controller issue

I'm trying to implement register from react-hook-forms for react-select but in order to do that I need to make use of Controller from react-hook-forms but when

Null is not an object (evaluating 'NativeMqtt.new client)

I'm using the MQTT protocol in my project, when I include the MQTT protocol with import * as Mqtt from 'react-native-native-mqtt' declare my client with const

How to manage multiple states in React? [closed]

I have components in my React App, with more than 20 rows with: useState() Is that the correct way or to assign them in a object, is there so

React-Router-dom and useHistory. Pushes new URL to history and changes URL but page does not change [duplicate]

I am to create an app which utilizes react-router-dom. I am currently trying to us eversion 5.2.0. I have tried to isolate the issue and focus

How can I dispatch an action using useEffect in main app.js?

I want to dispatch an action whenever any page or component of my app loads. So what I am trying to do is to dispatch the action using store.dispatch inside use

React link's onClick event state change is not happening

I have used react links with mui and I am trying to highlight the active link in header. My attempt is as below. import Link from "@mui/material/Link"; import {

Type 'StaticImageData' is not assignable to type 'string'

I'm struggling with interfaces on my little learning NextJS and TypeScript project. I thought I had it sorted out but am dealing with an issue on my Header.tsx

Display only one row and hide others in CSS Grid

I want to show only the first row of the Grid and hide other rows. I know we can do this by using max-height and the @media queries, but in this case, the heigh

Clear Radio buttons on Submit without getting errors

I want to clear the radio button values without getting errors of react in NextJS, i did manage to do in the other fields like in the example below... <div

Clear and reset form input fields

I have a form containing various input fields and two buttons; one for submitting and one for cancelling. <form id="create-course-form"> <input type

How to "Redirect to" after 'x' seconds using react-router-dom

I'm beginner in React Js. I would like to redirect to path '/event' after 2 seconds. This way is not working: import React from 'react'; import { getFormData }

React Testing Library: how to use screen in this case instead of container

in react testing library, as per the conventions, it is better to use screen than to destructure the methods from render. I have a component, where I need to te

Map not showing in mapbox

I'm using mapbox api for my application where user can add markers based on his current location. The map was loading just fine while it was running on localhos