Category "react-hooks"

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;

How to remove duplicated react? (Invalid hook call)

When using libraries (I tried styledcomponents and react-router), an error appears in React applications: Warning: Invalid hook call. Hooks can only be called

How can I keep my useSelector() variable from a redux store updated after each dispatch?(Redux Toolkit)

So I'm using React Native with Redux Toolkit and I'm facing this issue where once I dispatch and decrement a store value, the variable inside the component that

React state doesn't work, it doesn't rerender components

I have problem with react updating state. Well, I didn't touch react for a while and I want to remember some things so I've started from beginning. However, I f

Does useCallback make sense for not memoized components?

During reconciliation react compares trees and gets differences. Does it make sense to decrease those differences by using memoization hooks when components are

Unable to save to array React state from the response from the server

I'm trying to save my response.data to my array state of React, but it never stores the correct array. But when I do a temporary array it works. const [allstude

I18next and Webpack

I'm starting with Webpack and find problem with react i18next hook-useTranslation. // webpack.config.js const path = require('path') const HtmlWebpackPlugin = r

Cannot get gridApi in Ag-Grid using React hooks in Typescript

I am using function component in react with typescript. Here is what my component looks like const Table = (props: TableProps) => { const [gridApi, setGridA

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

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() {

How to stop Editor draftJS cursor jumping to beginning of text while typing in React Hooks?

I have the problem with the drafjs plugin which is Editor, thing is it jumps to the beginning of the text when I am typing in the Editor. I have found How to st

How to prevent re-rendering of components that have not changed?

I have a component that consists of several other components such as text fields, and when an input is made to the text field, all other components are re-rende