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

192
Visualizações
How to find the name of a variable calling a function?
const Button = myFunc();

Now from inside myFunc, I want to get the string "Button" (even before it is assigned to it). Is that possible?

Edit:

I see a lot of comments asking why this is even needed. I'm creating a React component by extending an existing component and adding styles to it (via a new style element at the document head). I want the new class to be called by ".RedButton", for example:

const RedButton = extend(Button)`
  color: red;
`;

...

const extend = OriginalComponent => {
  
  const newComponentName = ... // Here I need the use of "RedButton"
  ...
};
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