Category "react-hooks"

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

Avoid runnning an effect hook when Context get updated

I have a component MyContainer which has a state variable (defined via useState hook), defines a context provider to which it passes the state variable as value

Is there a library similar to Vueuse but for React?

Instead of having many dependencies for individual hooks, I am interested in a single curated and tested library like Vueuse, but for React. Does something like

Why can't `useCallback` always return the same ref

I don't understand why useCallback always returns a new ref each time one of the deps is updated. It results in many re-render that React.memo() could have avoi

Why can't `useCallback` always return the same ref

I don't understand why useCallback always returns a new ref each time one of the deps is updated. It results in many re-render that React.memo() could have avoi

Displaying data from Firestore into React Native FlatList did not work

I'm using the React Native FlatList module to show data that is stored in an firestore collection. This data should rendered into an content box with an colored

State Not Updating when Consuming React Custom Hook that Uses Axios with useReducer to Get Async Data

My app returns a "null is not an object" Render Error when consuming the useFetch custom hook that I made to get async data using axios. The status, error, and

How to call a function every minute in a React component?

I make a table to get stock price quotes, it works well, but when I try to put a function include setState in the component, it falls into an infinite loop, it

Custom React Hook typescript error on array return type

I've created a very simple custom hook: export function useI18n() : [ string, Dispatch<SetStateAction<string>> ] { const [ language, setLanguage

Custom React Hook typescript error on array return type

I've created a very simple custom hook: export function useI18n() : [ string, Dispatch<SetStateAction<string>> ] { const [ language, setLanguage