Category "react-hooks"

Redux RTK not auto-generating react hooks

Could not find any info on this that explains why its not generating and how to force it to re-generate these hooks. First I thought I had to run the app to get

How to put data inside a customize state in for loop in functional component

I get the data from the API as follows: [ { "GroupA1": [ { "code": 10, "name": "item1" }, { "code": 11,

What's the difference between onClick ={ () => function()} and onClick = {function()}?

What's the difference between this code: <button onClick={()=>props.submitHandler(searchInputValue)}>Submit</button> and <button onClick={pro

Avoid rerendering when doing button.click() inside useeffect()

I'm trying to set the data from child component to parent component's state in turn that data will be assigned to input text field. And then I want to automatic

React function executes continuously and state keeps refreshing

I have kind of a weird issue in React. I am using the Blitz JS framework along side with Prisma for database stuff. I have a function that queries the database

Cannot preview pdf-files larger than 2mb in chrome using FileReader

I want to preview PDF with FileReader before uploading the document to the database. There is no problem when I use Firefox, but if I use Chrome, files larger t

Change image onClick in React Js

I'm trying to create a page in my React Js project, with the content on the left side and content's image on the right side. So far, I was able to create a togg

PWA with React: Trying to create a object that updates every second and is accessible for many components

I'm currently working on a PWA build with React. I'm looking for a way to create one object which contains information like the current time (incl. seconds), cu

How to initialize data using map inside useState in ReactJs?

I'm new to React and in the assignment I'm working on, I have to show data in a AG Grid table. For that this is how I'm initializing rowData inside useState(),

useEffect and dependency array

I am trying to understand how react useEffect works with objects. Here is an example that will help demonstrate my question: export function UseEffectHook()

useState hook does not update inside setTimeout function

this code must increase the "count" value gradually from 0 to 600. And each time the "count" value changes it must be logged into the console. But instead, I ge

useCallback with onchange function in React JS

I have 2 components. In the parent component I have this: const Demo = () => { const [state, setState] = useState(true); const onChange = useCallback(

React - Error, Hookrouter invalid hook call

can't handle this error any suggestions? import "./App.css"; import { navigate, useRoutes } from "hookrouter"; const routes = { "/": () => <h1>h

React useContext to pass person object from signup to phone verification

I working on a portal using react and I am trying to pass the form data which is an object from the signup page to the phone verification page so I can verify a

Why does useEffect React Hook not work properly with dependency?

I'm working at a React Web App with Fullcalendar. I think one does not need to know Fullcalendar in order to answer this question. It's rather a matter of React

(Apollo client v3) useLazyQuery custom hook testing

I was struggling with a test issue for my custom useLazyQuery hook. My first test is passing but the second one is failing. What am doing wrong for the second t

Is it possible to pass props from a React Link to a functional component?

I have a sign up/sign on page, and I want to redirect the user to the last page that they visited on the site before they tried to sign up/sign on (or their pro

dom is not updated after state change via Context API

I am quite new to React and tried to finish a project on FrontendMentor. It's basically a simple OPA of an online store with just one product and the ability to

Unable to mock react-redux hooks after migrating to 8

I have been using the following pattern to mock react-redux hooks in tests that use Enzyme shallow rendering: import * as redux from "react-readux"; ... jest.sp

Why isn't my React context being updated?

When I use the app and navigate to the SetContext component, I see the value of auth is correct ("dummy value") and after entering a value in the edit field and