Skip to main content

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
0 votes
1 answer
14 views

How can I add keyboard support to my calculator program in ReactJS?

I am making a calculator program in ReactJS and am trying to add keyboard support to my program (as in the keyboard can be used instead of the buttons on the screen). Currently, the onscreen buttons ...
leah.cim's user avatar
1 vote
0 answers
22 views

Force React to rerender between processing simultaneous mouse events

Here is a basic example of the issue. A component contains two nested divs. We can keep track of the "depth" of the mouse position (0 if outside both divs, 1 if inside the outer div but ...
Arthur F.'s user avatar
  • 300
0 votes
1 answer
22 views

Date Sorting with Prime React

I'm having issues sorting a datatable with prime react on the Date column. Here is my code <Column field="Date" header="Date" sortable={true} body={(rowData: any)...
Hans's user avatar
  • 389
0 votes
0 answers
14 views

CoreUI Checkboxes Doesn't render it's state (React)

I use CoreUI React components to be able to select something. I see the state is updated, but the checkboxes and radios are staying unchecked. Here is a summary of the steps I have taken to resolve ...
Aleksei Avdeev's user avatar
1 vote
1 answer
22 views

Why Not Put the useState Hook in an If-Statement?

Intuitively it makes sense to me why, but I'm looking for an in-depth explanation of how React is compiled that would cause a side-effect with something like this. const Header = () => { const [...
BobDidley's user avatar
  • 127
0 votes
0 answers
13 views

useState to hide elements in Navbar?

I want to hide some links in my Navbar. There are three different types of user, and each of them will see some other links on the navbar. For example: User 1 - Link 1 and Link 2 User 2 - Link 3 and ...
Primo Centurio's user avatar
-1 votes
1 answer
18 views

React state update and useEffect not behaving as expected in Next.js application

I'm experiencing unexpected behavior with state updates and useEffect in my Next.js application. I have a component with a lock/unlock functionality, but the state updates and side effects are not ...
wormhole's user avatar
0 votes
0 answers
20 views

How to resize table rows based on its content?

I am trying to write a logic where table rows are resized based on its content. I am currently using @tanstack/react-table and @adsk/alloy-react-table for the table creation. Current table ...
Rohan Mishra's user avatar
0 votes
0 answers
24 views

share data across React application with useContext Hook

I'm quite new to React...and I have created a context where I'm storing data, making some calculations and using this context in multiple components. With my current knowldge I'm struggling always ...
beanCounter's user avatar
0 votes
0 answers
24 views

How can I export click event callbacks that use React state from within a component?

I'm building a Dashboard to visualize a few NLP experiments. Here's a snippet from the Dashboard component (.tsx) I've currently written: import { Dispatch, SetStateAction, useEffect, useState } from &...
Sachintha's user avatar
1 vote
1 answer
33 views

React onMouseEnter event.currentTarget is always null

I am using React d3 tree with a custom node element. I am trying to show some text on hovering a node, but it only works the first time I hover over one, then the mouse.currentTarget seems to be null ...
bogdmu00's user avatar
0 votes
1 answer
55 views

use a hook inside a function

I'm a beginner in react and JS. I want to refactor and clean up my endless files a little and seperating in files for different tasks. So I created a lib folder and created a file called ...
beanCounter's user avatar
0 votes
1 answer
18 views

My useState Controlled Input Checkbox keeps malfunctioningI

I have a Checkbox theme switch in my app with a simple theme context to manage theme switching and everything works fine but i always have to click my checkbox 2 times to show it correctly according ...
Tazer Blaze's user avatar
0 votes
1 answer
16 views

Fetching data from firebase and forwarding it to another component forwards an empty array

I am using an array and useState() to fetch the data from the firebase database. The array is initially empty. However after I recieve the data from the firebase after its initial loading and try to ...
NAMAN SAINI's user avatar
0 votes
0 answers
19 views

React Component is not updating after context value changes

I wanted to create a markdown editor that would preview the markdown code in a window. So on the left top section, there is a reset button that appears when (not the one that is already there). You ...
Prathmesh Waghmare's user avatar

15 30 50 per page
1
2 3 4 5
2062