Bolt ui

React State Not Updating - Component Doesn't Re-render

You update React state with setState() or useState hook, but the component doesn't re-render. The state seems to update in DevTools but the UI doesn't change.

This happens with objects and arrays particularly.

Error Messages You Might See

State updates but component doesn't re-render OldValue shown in UI but state shows newValue Object mutation warning in strict mode
State updates but component doesn't re-renderOldValue shown in UI but state shows newValueObject mutation warning in strict mode

Common Causes

  1. Mutating state directly instead of creating new reference: state.obj.prop = newValue (WRONG)
  2. Not creating new array/object: setState([...state, item]) works, state.push(item) doesn't
  3. Setting state to same reference (React sees no change): setState(state)
  4. Async state update where component unmounts before update
  5. setState in useCallback without dependency causing stale closures

How to Fix It

Always create new references: setState({...state, key: newValue}) for objects

For arrays: setState([...state, newItem]) or setState(state.filter(...))

Use immutable patterns: setState(prev => ({...prev, key: value}))

Check DevTools - if state actually updates but UI doesn't, it's an immutability issue

For complex state: consider useReducer for clearer intent

Real developers can help you.

Meïr Ankri Meïr Ankri Full-stack developer specializing in React / Next.js / Node.js with 6+ years of experience. I've worked across various sectors including automotive (Reezocar/Société Générale), healthcare (Medical Link SaaS), and e-commerce (Glasman). I build web apps end-to-end, from architecture to production, with a focus on scalability, performance, and code quality. I also mentor junior developers and contribute to technical decisions and code reviews. Costea Adrian Costea Adrian Embedded Engineer specilizing in perception systems. Latest project was a adas camera calibration system. PawelPloszaj PawelPloszaj I'm fronted developer with 10+ years of experience with big projects. I have small backend background too Simon A. Simon A. I'm a backend developer building APIs, emulators, and interactive game systems. Professionally, I've developed Java/Spring reporting solutions, managed relational and NoSQL databases, and implemented CI/CD workflows. Caio Rodrigues Caio Rodrigues I'm a full-stack developer focused on building practical and scalable web applications. My main experience is with **React, TypeScript, and modern frontend architectures**, where I prioritize clean code, component reusability, and maintainable project structures. I have strong experience working with **dynamic forms, state management (Redux / React Hook Form), and complex data-driven interfaces**. I enjoy solving real-world problems by turning ideas into reliable software that companies can actually use in their daily operations. Beyond coding, I care about **software quality and architecture**, following best practices for componentization, code organization, and performance optimization. I'm also comfortable working across the stack when needed, integrating APIs, handling business logic, and helping transform prototypes into production-ready systems. My goal is always to deliver solutions that are **simple, efficient, and genuinely useful for the people using them.** MFox MFox Full-stack professional senior engineer (15+years). Extensive experience in software development, qa, and IP networking. hanson1014 hanson1014 Full-stack developer experienced in fixing and deploying AI-generated apps from Lovable, Bolt.new, Cursor, and Replit. I specialize in debugging Supabase integration issues (auth flows, RLS policies, database connections), fixing broken deployments, resolving routing/blank screen problems, and cleaning up messy React/Vite codebases. I also build production apps with the Claude API and have shipped a Mac desktop dev tool (Nexterm from scratch. Based in Hong Kong, fast turnaround. Luca Liberati Luca Liberati I work on monoliths and microservices, backends and frontends, manage K8s clusters and love to design apps architecture Omar Faruk Omar Faruk As a Product Engineer at Klasio, I contributed to end-to-end product development, focusing on scalability, performance, and user experience. My work spanned building and refining core features, developing dynamic website templates, integrating secure and reliable payment gateways, and optimizing the overall system architecture. I played a key role in creating a scalable and maintainable platform to support educators and learners globally. I'm enthusiastic about embracing new challenges and making meaningful contributions. Nam Tran Nam Tran 10 years as fullstack developer

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Why doesn't setState work with objects?

React compares references. If you mutate the same object, it looks unchanged. Create new reference: {...state, prop: value}

What's the difference between setState(state) and setState({...state})?

setState(state) doesn't trigger re-render because reference didn't change. setState({...state}) creates new reference

Should I always use ...state?

Yes, when you're changing properties. For full replacement, setState(completeNewValue) is fine

Related Bolt Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help