Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

86
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda