All Questions
Tagged with state typescript
201
questions
0
votes
0
answers
65
views
How to Manage User State in Next.js 14: Context, Zustand, or Redux? [closed]
I've been working on a Next.js 14 application that supports two types of users: Admin and User. My goal is to have a globally accessible user state throughout my application without needing to run ...
0
votes
0
answers
14
views
Updating persisted zustand functions breaks app when deploying
Some background:
I'm building a new feature in a rather larger app. This feature should work across different pages so a state management solution is warranted. To handle such management, I've used ...
0
votes
1
answer
112
views
State both ways between Server and Client components in Next 14
I am trying to lift state up from a client component to a server component, do some stuff on the server and pass state back back down from server to client via props.
I'm creating a booking system ...
0
votes
0
answers
20
views
React useHookState - resetState
I use useHookState for statemanagement in react.
My example state got an defaultState.
I want to reset my current state to the defaultState when I call resetState
Is there a way that is prettier than ...
0
votes
1
answer
314
views
update zustand store in onChange event create input delay
I have a input delay issue when I try to set the state of a zustand variable in onChange event.
const BuildOrder = (props: { setOpen: Function }) => {
const { almacenes, isLoadingAlmacenes } = ...
0
votes
0
answers
27
views
React components don't re render when the state is changed
App.tsx:
import Router from "./components/Router.tsx"
import {useState} from "react"
import Car from "./components/Car.tsx"
export default function App() {
const [...
0
votes
0
answers
21
views
Ngxs patch<T> change the type to Object
I'm specifying model just in case :
class Zoo {
//things
enclosures: Array<Enclosure>;
}
class Enclosure {
//things
animals: Array<Animal>;
}
class Animal {
//things
}...
0
votes
1
answer
102
views
React TypeScript: Preventing component restart when switching tabs in app
I'm developing a React TypeScript application where I've implemented tabbed content, similar to a browser. Each tab contains a component, and I've encountered an issue where switching tabs causes the ...
2
votes
2
answers
308
views
State update is causing Next.js to soft refresh the page
I have a modal component in my Next.js project using Radix UI. There are different two way binded inputs using state. The problem is when the state is update the entire page re-renders causing all ...
0
votes
1
answer
29
views
useState isn't working when parent useState function is applied
I have a ticket child class that sets the total amount after no of tickets has been been changed the problem i am facing here is setNumber doesn't seem to work unless setTotal is commented out, i don'...
0
votes
1
answer
144
views
Prevent react native component from re-rendering on every state change
I have a component witch should either show A or B based on whether the user is nearby a certain location. I created a custom hook for retrieving the value of the user being nearby.
My problem is that ...
0
votes
0
answers
559
views
Zustand 4 slices pattern with devtools and persist middlewares
I am trying to use zustand 4 for my state management in my react & typescript project. I am attempting to use the slices pattern that has devtools and persist middlewares for the boundstore, but I ...
0
votes
2
answers
57
views
Weird React state behavior? Doing a save File or setTimeout fixes the issue?
I tried searching on google and chatGPT but I had no luck , and this is making me lose my hair. I cannot figure out why the react states are behaving this way. I have an application that fetches news ...
0
votes
3
answers
65
views
State will not update onClick
I am having an issue with my recipe project. In this section users can add their recipe steps. The user clicks on the plus button to add a textarea to write a new step and clicks on the minus button ...
2
votes
1
answer
157
views
How to properly update a state variable when focusing on a screen in React Native?
I have a state variable in my React Native Project. It needs to be updated when a specific function is called. However, the setState method being asyncronous results in my variable being updated after ...