Questions tagged [react-hooks]
React Hooks are a feature that allows developers to use state(s) and other React component lifecycle features without writing a class-based component.
react-hooks
30,908
questions
0
votes
0
answers
29
views
Not able to get inside the for loop in React js
I am making a To-Do App. I am using React frontend, Node backend, and Postgresql DB.
I made a component called <TaskLists /> which takes three properties or props:
startDate
endDate
allTasks
...
0
votes
1
answer
26
views
Cannot update state from child element in React (functional components)
I want to have a child component reference and update a state; however, when I try to do so, it only works once or twice before breaking. Strangely, the parent element can still update the state.
...
-3
votes
0
answers
15
views
Invariant failed: A state mutation was detected between dispatches [closed]
This is the body of the code
const tableHeader = [
{ title: "Product name", widthClass: "w-[25%]" },
{ title: "Product category", widthClass: "w-[19%...
0
votes
0
answers
22
views
How to make a tooltip for a column in a table if the text in the column is larger than 250 pixels
I am using tailwind and shadcn for development.
My idea is that if the text in a column is larger than a certain number of pixels, it should be possible to see a tooltip from the shadcn library for ...
0
votes
2
answers
57
views
Change in locale is not affecting the application
I am creating an application with dayjs as the date-time library. In the application I am setting the default locale to "en" at the app level and when I am changing the language in the ...
0
votes
2
answers
34
views
Working of useSearchDebounce custom react hook
I found this code from this answer https://stackoverflow.com/a/68780417/26420821
How does it work?
export function useSearchDebounce(delay = 350) {
const [search, setSearch] = useState(null);
...
0
votes
1
answer
21
views
useState returning empty array on default state, using react + supabase
I need help to understand why when I console.log(menus) on Menu.jsx it returns an array of values, but if I console.log(item) it only returns an empty array, while the default value of the item is &...
0
votes
1
answer
61
views
onClick method not working in my React Project [closed]
I am creating a react eCommerce project everything is done but I'm having troubles in login page I created an account in firebase and configured it to allow user to login via their google account.
For ...
0
votes
1
answer
18
views
Keep scroll bar Y position after re-render in react
I tried all other similar questions here but there were about 3 years ago questions and answers which's not working right now.
So I have a child component which contains table and in the parent ...
0
votes
3
answers
48
views
Multi-line Truncated Text with "..." in the end
I need help with Multi-line Truncated Text. I can't cut the final word with "..." in text block with randon string number
So this is my solution which cut the end of my block, but without &...
0
votes
0
answers
19
views
Redux State Does Not Change When Modified From useInterval
so im trying to load user data from localStorage and set it to the redux user state. heres what i have done:
Where The User Is Being Used:
import Fruit from "../components/Fruit"
import { ...
0
votes
0
answers
17
views
Does useFormState/useActionState React hook handle multiple requests gracefully like TanStack react-query?
TanStack react-query does a good job handling scenarios where the same request is made multiple times before getting a response.
Does React's useActionState (originally called useFormState) hook ...
1
vote
0
answers
13
views
Cant put tsparticle.js component on each carousel slide of React.js
I am using the tsparticle.js with React and Tailwind css for design in my code in the carousel slides but i cant see that on each slide. It appears only on first slide. The rest of the slides are ...
-4
votes
1
answer
38
views
I want to prevent my React app from Security Vulnerability [closed]
I am getting 7 security vulnerabilities (4 High and 3 Moderate). I didn't find any solution to fix those.
I am getting those vulnerabilities with Checkmarx Application Security Testing Tool. Below are ...
0
votes
1
answer
33
views
Unable to pass prop to api function from UseEffect in React Next.js
Just for full context, I am using App Router in next.js.
I am having trouble passing 'serial_num' as an argument to my api function "fetchImages" when I am trying to trigger it from inside ...