Category "react-hooks"

How to re-render react-table in .js when data changes in another .js

I am new to react-table and trying to re-render a react-table when data supplied to it changes. Is there anyway to do so? I have tried using useEffect() with no

A problem that i am having making conway's game of life in react (nextjs). when i press the Random button while it is running, it starts flickering

Here is a the code for you to try. both button works fine while the game is paused or running very fast, but if i set the timeout above 100 or 200 ms and the ga

A problem that i am having making conway's game of life in react (nextjs). when i press the Random button while it is running, it starts flickering

Here is a the code for you to try. both button works fine while the game is paused or running very fast, but if i set the timeout above 100 or 200 ms and the ga

Target map()'ed items one by one

I want to create a contact form where the form fields are changed after they are filled. For example when you fill the email field, you press enter or click the

How can I render only once an Alert component in react native?

How can I render only one time an Alert component in react native if my dashboardScreen is being render many times? I'm using Context api, if I dispatch an acti

React hooks: Why do several useState setters in an async function cause several rerenders?

This following onClick callback function will cause 1 re-render: const handleClickSync = () => { // Order of setters doesn't matter - React lumps all state

Make hooks stop randomizing background color

So I wanted to use hooks for an exercise where I have a circle follow my cursor in React ( and then see other users circles using node) so I've set a randomColo

React Dev Tools: "parse hook names" action throws a "Hook parsing failed" error

When I inspect my code using the react devtools, I'm noticing some hooks trigger this error and cause the "parse hook names" action to error out. When I inspect

Can I change the state for given time and then revert it back to the original state using settimeout

I want to get the value to true for one second, after which it will revert back to false using settimeout but stuck. Here is my code: const [value, setValue] =

How do I save responses from an API to a state so that I can display old searches/responses?

Here's what I'm trying to do: First, I want to display the response I receive from the API (I can do that), but then I want to display the previous prompts and

next-auth only valid absolute URLs can be requested

I updated [email protected] to [email protected] for okta signin(reactjs). After that I am getting the following errors: [next-auth][error][SIGNIN_OAUTH_ERROR] htt

Next.js router.query getting undefined on refreshing page, but works if you navigate to it from Link component [duplicate]

Why is router.query empty when I refresh a page with the correct id in the URL, but when when I navigate towards it through , it works? say I

UseReducer hook doesn't update state (Can't perform a React state update on an unmounted component)

I'm trying to use useReducer instead of useState in a custom hook that loads the initial data from the API, and getting an error updating a state. (I use useRed

Setting state in React useEffect hook

In my app I fetch data from my API after a button is clicked that changes the state of endpoint. Until the data is fetched I want to display a loading icon. Aft

How can I call Rtk Query Hook when the condition changes?

I created the endpoint with createApi: export const postsApi = createApi({ reducerPath: 'postsApi', baseQuery: fetchBaseQuery({baseUrl: 'https://jsonplaceho

React Native FlatList Items Disappearing

I have a Modal that the user selects categories from, and then that category loads into a FlatList on their profile page. When the first category is selected, i

How to reach multiple elements in an array without using axios

Yesterday i saw a React project on youtube and i wanted to test it myself. This function connects to the link and returns me the questions of the category and d

Custom hook not updating in component

I have a custom hook that looks roughly like this: export default function useMyHook() { const [foo, _setFoo] = useState([]); const [bar, setBar] = useState

Custom edge detection for React tooltip causes page to "flash" occasionally

So I created simple edge detection for a tooltip that is part of a charting library. I can't use tooltips that already have implemented edge detection (like MUI

React memo get magically executed twice [duplicate]

i'm creating a react app with useMemo. The memo uses empty array as the dependency list, so it should be executed once, right? Inside the memo