I am wrapping my App.js file in the withLDProvider component and I want to know how I can set the user information from inside of my App function.
Let's say for example I get the username that is cached in Dexie inside of my App function, how can I pass that user information to where the user details are set when exporting the App function.
I can already get all my user information, just not sure how I am supposed to pass the user information. I feel like I am taking the wrong approach here but am not too sure exactly how to go about this.
import React from 'react';
import './App.css';
import { withLDProvider } from 'launchdarkly-react-client-sdk';
import HelloWorld from './HelloWorld';
const App = () => {
const [user, setUser] = useState({});
// Let's say for example that I asynchronously get my
// user information here and use hooks to set the user
return (
<div className="App">
<header className="App-header">
{
user ? <HelloWorld />
: <div>A login screen would go here</div>
}
</header>
</div>
);
}
export default withLDProvider({
clientSideID: 'client_id',
user: {
key: 'user_key',
name: 'User Name',
email: 'User@email.com'
}
})(App);