Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

221
Vistas
React - State updating function not triggering component re-render in Chrome extension

Problem: For some reasons my submittedSev state does not seem to re-render in the DOM upon calling it's state updating function setSubmittedSev(). However, I can see console logs renders for sev parameter. Why is this happening?

Expected outcome – I expect the popup component to re-render upon calling submittedSev() function. And so for my text stored in data variable to also update.

popup.tsx

const App: React.FC<{}> = () => {
    const [submittedSev, setSubmittedSev] = useState('High');

    const data = [{
            title: 'Title example',
            summary: 'Summary Example',
            body: `${submittedSev}`,
            sevChange: true
     }
    ]

    const selectOptionHandler = (index) => {
     setCurrentOption(data[index]);
    };

    const submittedSevChangeHandler = (sev) => {
        setSubmittedSev(sev); // Not triggering re-render
        console.log(sev) // Correctly logs to the console
    };

    return (
    <div className="App">
        <aside>
            <ResponseList
                onSelectOption={selectOptionHandler}
                responseData={data}
            />
        </aside>
        <main>
            <ResponseDetail
                details={currentOption}
                onChangeSubmittedSevHandler={submittedSevChangeHandler}
            />
        </main>
    </div>
        );
      };

ResponseDetail.tsx - Child component

const ResponseDetail = (props) => {
  
    const submittedSevUpdateChangeHandler = (e) => {        
        props.onChangeSubmittedSevHandler(e.target.value);
    };

    return (
     <select onChange={submittedSevUpdateChangeHandler}>
      <option value="Low">Low</option>
      <option value="Medium">Medium</option>
      <option value="High">High</option>
     </select>
     )
    }
about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda