Really excited about flagsmith. Just getting started with react.
I'm glad there are hooks available but right now I'm finding myself writing a wrapper hook to make it work better in my project. Am I ttly doing this wrong?
As far as I understand I only want to identify the user once, start listening, and subscribe once. Then throughout the app I might grab the value of feature flags.
But right now I've written a hook to ensure things are initialized, and is listening, and then another hook that uses that to just grab a value. Am I missing something?
I would like to just be able to do something like
const myFeature = () => {
const {value, error} = useFlag('my_flag_name');
if (error) {
return <>ERROR: {error.toString()}</>
}
if (value == undefined) {
return <>Loading</>
}
// use the value in some part of the component here.
};
Is there a reason that the initialization, subscribing, and identification, and getValue is all together in the same hook?
Really excited about flagsmith. Just getting started with react.
I'm glad there are hooks available but right now I'm finding myself writing a wrapper hook to make it work better in my project. Am I ttly doing this wrong?
As far as I understand I only want to identify the user once, start listening, and subscribe once. Then throughout the app I might grab the value of feature flags.
But right now I've written a hook to ensure things are initialized, and is listening, and then another hook that uses that to just grab a value. Am I missing something?
I would like to just be able to do something like
Is there a reason that the initialization, subscribing, and identification, and getValue is all together in the same hook?