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

283
Views
ReactJS - How to return a string from functional component?

In react, I am using @apollo/client for backend APIs. In appollo.js I am trying to call backend API link based on condition.

Right now appollo.js contains only functions, its not a component.

I am trying add statsig feature to it, const featureOn = useGate(<FEATURE_GATE_NAME>).value;

How can I use statsig variable inside appollo.js?

Also I have tried by creating separate component and rendering like <AbcComponent />, but its not return a required value.

AbcComponent.js,

export const AbcComponent = () => {
  const featureOn = useGate('abc').value
  return featureOn ? 'Yes' : 'no'
}

In this scenario, how can I get 'Yes/No' from appollo.js?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Component in react should always return a JSX . what you need here is a custom hook.

export const useCheckFeatureOn = () => {
    const featureOn = useGate('abc').value
    return featureOn ? 'Yes' : 'no'
  }

Use the above hook wherever you want to consume the value

const isFeatureOn = useCheckFeatureOn();
about 4 years ago · Juan Pablo Isaza Report
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!