react-hooks Questions
7
Solved
As the title suggests, I am new to using useQuery and the associated libraries, I am trying to use it to fetch data and then populates a list of fields that I have created
However when I run it I g...
Capias asked 11/12, 2021 at 23:33
4
When I upgraded nextjs application from 9 to 12. There were some errors shown, that were not being taken take care of in previous version. One of them was: typeError: destroy is not a function
In t...
Horntail asked 19/5, 2022 at 14:30
3
Solved
I am attempting to pass an object through props to a child component. The value is set in the useEffect hook and lost when passed to my child component.
I have tried setting the value of the obje...
Curtice asked 15/5, 2019 at 18:53
4
Solved
I'm trying to get the data from a form in which some fields are dynamic so that their names follow a pattern like the days of the week ending in 1 or 2.
In the onChange I send the name of the compo...
Golden asked 28/1, 2021 at 20:53
6
Solved
Hi I have been stuck in a React Function useState. I just want to learn hooks and useState, but I can not have any progress even struggling too much to find a solution. Here is my full react functi...
Disassociate asked 12/12, 2019 at 12:10
8
Solved
I'm playing with React Hooks - rewriting a form to use hook concepts. Everything works as expected except that once I type any 1 character into the input, the input loses focus.
I guess there is a...
Tunable asked 13/1, 2020 at 10:50
18
Solved
The useEffect React hook will run the passed-in function on every change. This can be optimized to let it call only when the desired properties change.
What if I want to call an initialization func...
Filtrate asked 2/11, 2018 at 14:58
4
Solved
I am trying to implement hooks into a React (^16.6.0) application using TypeScript
import * as React, {useState} from 'react';
Any idea what is the right syntax for this import?
Satiate asked 21/11, 2018 at 14:29
6
Solved
I'm working with a simple component that does a side effect. My test passes, but I'm getting the warning Warning: An update to Hello inside a test was not wrapped in act(...)..
I'm also don't know...
Viyella asked 7/2, 2020 at 14:57
5
Solved
To better learn React, TypeScript, and Context / Hooks, I'm making a simple Todo app. However, the code needed to make the context feels cumbersome.
For example, if I want to change what a Todo has...
Easel asked 20/4, 2020 at 22:35
6
Solved
I need help with react-query library.
I fetch a list of objects and then for everyone I need to fetch additional data from another service. How should I do this with react-query useQuery hook?
Exa...
Melodie asked 17/2, 2020 at 10:41
9
I am using material-ui autocomplete. I am passing to its property options some array of states. The problem I face is with getOptionLabel:
Material-UI: The `getOptionLabel` method of Autocomplete ...
Gateway asked 16/7, 2020 at 11:21
4
Solved
I am working with react hooks and to validate my form fields I am using react-hook-form as it is the best option for now
SO to validating my normal input fields I am doing just ref={register({ requ...
Endurance asked 25/6, 2020 at 11:53
1
Im trying to add the correct type to my d3.select statement in order set the mySVG variable.
function App() {
const [mySVG, setMySVG] = useState<d3.Selection<d3.BaseType, unknown, HTMLElemen...
Melquist asked 13/1, 2021 at 5:9
6
useState does not update the state immediately.
I'm using react-select and I need to load the component with the (multi) options selected according to the result of the request.
For this reason, I ...
Murphree asked 12/3, 2021 at 20:49
5
Recently I was been reading react-redux docs https://react-redux.js.org/next/api/hooks
And there was a section related to Equality Comparisons and Updates, which says:
Call useSelector() multiple ...
Wirework asked 27/11, 2019 at 14:18
8
Solved
React Hooks give us useState option, and I always see Hooks vs Class-State comparisons. But what about Hooks and some regular variables?
For example,
function Foo() {
let a = 0;
a = 1;
return...
Houseroom asked 5/10, 2019 at 21:25
4
Solved
I am trying to create a custom button component in a React Typescript project that use React Hooks and Styled components.
// Button.tsx
import React, { MouseEvent } from "react";
import styled fro...
Odisodium asked 27/2, 2020 at 15:7
2
Solved
<MyContext.Consumer>
{value => { }}
</MyContext.Consumer>
VS
let value = useContext(MyContext);
What is the difference between this two snippets, using Context.Consumer and usin...
Gaslight asked 29/6, 2019 at 9:12
15
Solved
I'm trying out the new React Hooks and have a Clock component with a time value which is supposed to increase every second. However, the value does not increase beyond one.
function Clock() {
...
Potion asked 27/10, 2018 at 17:25
2
In VSCode, how can I get auto import suggestions for React built-in hooks, like useState, useEffect, etc?
Just like what we get in CodeSandbox:
Enabled extensions (maybe there is some conflict ...
Bathilda asked 19/2, 2020 at 15:8
19
Solved
Currently starting up the server on my client side, the error above is what I have been
getting. I am using TypeScript, ReactJS, ESLint. I can't seem to go forward since this error
has been hauntin...
Expostulation asked 29/5, 2020 at 5:48
4
When I inspect my code using the react dev tools, I'm noticing some hooks trigger this error and cause the "parse hook names" action to error out. When I inspect the react dev tools, it o...
Socorrosocotra asked 19/10, 2021 at 2:59
0
I have a React Native project and I'm currently looking into performance using the flamegraph in React Devtools.
Now it's telling me a lot of time in some renders is spent on "Passive effects&...
Barred asked 6/10, 2023 at 13:31
5
Solved
Recently I was working on React Hooks and got stuck with one problem/doubt?
Below is a basic implementation to reproduce the issue, Here I'm just toggling flag (a state) variable on click of the b...
Sumbawa asked 16/3, 2019 at 15:37
© 2022 - 2024 — McMap. All rights reserved.