Skip to main content
Best practices
1 vote
4 replies
58 views

So, being used other reactive frameworks I'm now starting to learn and work with React. I'm building a simple exercise and I'm struggling with the way State is managed in React, I'll already have ...
Noel Rubio Lavilla's user avatar
0 votes
2 answers
160 views

Here are two React components: function MainScreen() { const [stopwatches, setStopwatches] = useState([ new Stopwatch('A'), new Stopwatch('B') ]); const [selectedStopwatchIndex, ...
eric's user avatar
  • 31
2 votes
1 answer
115 views

The below block of code works. Component rerenders when state changes from parent (MainBox) export function MainBox(){ const [valuestate, setvalueState] = useState() return( <div&...
Coffee's user avatar
  • 37
2 votes
2 answers
211 views

Ref interface: // create const count = useRef(0); // update (does not trigger render) count.current = 5; // access console.log(count.current); State variable interface: //create const [count, ...
Always a Newb at Something's user avatar
0 votes
1 answer
75 views

I'm trying to write a custom React hook that fetches data. It seems to work partially — but loading goes false before data is set, and error is never set even when a request fails. import { useState, ...
Work Profession's user avatar
0 votes
2 answers
62 views

I am trying to build a custom form component. In this I use inertiajs useForm hook to automatically load the data into a state (similar to react-use-form). But my problem is, that everytime i type a ...
Henry's user avatar
  • 1
0 votes
2 answers
81 views

perms is an array of objects. Each object is: { catg: 'Catg1' serv: ->array of serv objects { checked: false, desc: 'Serv 1' } } On button click, based on ...
DavidC's user avatar
  • 195
-1 votes
1 answer
45 views

I have a parent component where I use state to control the visibility of a child component. If I use a button to open a modal it works, but when I change the state in useEffect child prop = false ...
Алексей Смирнов's user avatar
2 votes
1 answer
76 views

In my React Native app, I'm having a problem where the setState function is not being recognized as a function. I already inserted the context provider on the App root page and exported the context ...
Vivantt's user avatar
  • 43
-1 votes
1 answer
59 views

I try to make some kind of infinite scroll Here is my CodeSandbox setup (first approach) To paginate I made some kind of cursor which keeps last loaded item id in after state variable I use that after ...
bankangle's user avatar
  • 129
0 votes
1 answer
793 views

I'm trying to compose my own Combobox component using Shadcn ui. In doing this I am using the Command component. I am trying to bind my command input value to React state in Next.js client component ...
Ethan's user avatar
  • 1,868
0 votes
1 answer
83 views

I have two files/components: Createrisk.jsx for creating individual risks Tablepage.jsx displays the risks in an MUI Data Grid The problem is Tablepage renders only the attributes from Createrisk ...
Aleks3000's user avatar
1 vote
0 answers
95 views

I am using monaco-editor and I created a code preview. In the previewer, I want to copy the contents, but everytime I click my copy button, it always rer-renders. What am I missing? or How should I ...
master shifu's user avatar
-1 votes
1 answer
56 views

I am using DataTables in a NextJS project. I'm getting data from the backend with: const [rows, setLocalRows] = useState([]); useEffect(() => { if (Array.isArray(initialRows)) { setLocalRows(...
mbakgor's user avatar
  • 31
0 votes
1 answer
33 views

I'm building a React app where I store a boolean value (hasGuessed) in localStorage. This value should reset to false every day at midnight. Currently, I'm using setTimeout to schedule the reset at ...
user29783777's user avatar

15 30 50 per page
1
2 3 4 5
88