Category "react-hooks"

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

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

React hooks: how to instantiate instance variable only once

I would like to derive value from my props using react hooks. I would like to compute this value only once and not on every render. This is the first solution I

How can solve this error "Uncaught TypeError: inputArgs[0].match is not a function"

When login first then immediatly show:- "Uncaught TypeError: inputArgs[0].match is not a function" this error . I'm using react-firebase-auth hook. when I try

react useEffect comparing objects

I am using react useEffect hooks and checking if an object has changed and only then run the hook again. My code looks like this. const useExample = (apiOptio

Compare value inside of use-deep-compare-effect

This is a part of use-deep-compare-effect source code export function useDeepCompareMemoize<T>(value: T) { const ref = React.useRef<T>(value) co

How to use componentWillMount() in React Hooks?

In the official docs of React it mentions - If you’re familiar with React class lifecycle methods, you can think of useEffect Hook as componentDid

How to compare oldValues and newValues on React Hooks useEffect?

Let's say I have 3 inputs: rate, sendAmount, and receiveAmount. I put that 3 inputs on useEffect diffing params. The rules are: If sendAmount changed, I calcul

Can we use object destructuring for useState() in reactjs hooks?

As from the documentation from Hooks in Reactjs, const [count, setCount] = useState(0); they use array destructuring. Can we use object destructuring in pl

How to validate password and confirm password in react hook form? Is there any validate property and message in react hook form to show errors?

Actually, I try to validate the form and Stucked to validate the password and confirm the password.. is there any property in useForm to validate the password a

Unable to update state while using React Native

I am trying to get to grips with the React hook useState. At the moment I am unable to update the state of my errors object, a little unsure of where I am going

Yup returns always an error even if all fields are valid

Yup is returning always one error in the array even though all fields are valid. The validation is working fine, is checking each field and showing the errors c

React "useRef": no access to method in .current

So in my React Native application, I want to integrate this slider, following the guidance here. Problem is, I want to get access to the method setLowValue()

Prevent rerender react array of objects

I have an Ul component which contains an array of objects with different values in it. Each item called TestCase in this list has a button which makes a restcal

React Hooks: useEffect() is called twice even if an empty array is used as an argument

I am new to reactJS and am writing code so that before the data is loaded from DB, it will show loading message, and then after it is loaded, render components

Create react functional component with hook and publish him in npm package

I try to create own npm pack. I created and published my component, it is working, but when I add UseEffect in my component I have errors. What is goin on? impo

How to populate a div from the data from fetch

I am getting my output in a react app at this.state but I want to bring this outside and populate div so that I can show it at the frontend. How can I do it? f

fetch from api that I send requested in react-table

I will need a server-side table so after I saw react-table got 9k+ stars on github then decided to use it. I'm trying to build a React-Table which can make poll

Definition for rule 'react-hooks/exhaustive-deps' was not found

I am getting the following eslint error after adding // eslint-disable-next-line react-hooks/exhaustive-deps in my code. 8:14 error Definition for rule 'r

How test a component using the useReducer hook?

Reducer // src/reducers/FooReducer.js export function FooReducer(state, action) { switch (action.type) { case 'update': { return action.newState;