Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!