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

191
Views
How do I retrieve custom properties on a LaunchDarkly user?

I'm trying to add an attribute to a LaunchDarkly user, and retrieve it on subsequent reloads.

Here's a simplified example:

import { withLDProvider } from 'launchdarkly-react-client-sdk';
export default withLDProvider({
  clientSideID: 'your-client-side-id',
  user: {
    "key": "abc",
  },
  options: { /* ... */ }
})(YourApp);

const YourApp = () => {
  const client = useLDClient();
  useEffect(() => {
    if (client) {
      const user = client.getUser();
      
      // Expectation: logs "{ key: 'abc' } on first load,
      // and "{ key: 'abc', firstName: 'Evan' }" on subsequent reloads
      console.log('Received', user);

      const updatedUser = { ...user, firstName: 'Evan' };
      client.identify(updatedUser);
    }
  }

  ...
}

What I'm seeing is that after reloading the page, the 'firstName' attribute is not being retrieved.

Expected:

  • First load: Received { key: 'abc' }
  • Second load: Receieved { key: 'abc', firstName: 'Evan' }

Reality:

  • First load: Received { key: 'abc' }
  • Second load: Received { key: 'abc' }

Am I misunderstanding what getUser() is supposed to do?

My understanding is that calling identify() should update the user profile. I would think that on subsequent getUser() calls with the same key, I should get back the firstName that is added when calling identify() but that's not what I'm seeing.

I've read through all the docs and I can't tell if this is expected behavior, or if I'm doing something wrong.

I'm using the React Client SDK ("launchdarkly-react-client-sdk": "^2.22.2")

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!