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

90
Vistas
Change prop value

I am working on an old app which used to have the following index.tsx

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { MyApp, MyAppProps } from './components';

function init(element: HTMLElement, options: MyAppProps) {
  ReactDOM.render(<MyApp {...options} />, element);
}

The object MyAppProps is an interface with few defaults. Because I want to be able to change one of these defaults based on the URLParams, I thought to introduce a simple

const queryParams = new URLSearchParams(window.location.search);  
const myKey = queryParams.get('myKey')

and then pass the myKey with a line like this

let MyAppProps.key = myKey

but it does not work. I cannot figure out how to correctly construct this piece of code. It seems I should create an object of the same type of the interface so that I can manipulate, but all my tests are failing.

about 4 years ago · Juan Pablo Isaza
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