For backwards compatibility with a previous featur...
# sdk-react
m
For backwards compatibility with a previous feature flag platform we have a provider that puts the status of all the feature flags from growthbook in a context, something like:
Copy code
export const FeatureFlagProvider: FC<PropsWithChildren> = ({ children }) => {
  const growthbook = useGrowthBook();
  const flags = ['foo', 'bar', 'fizz', 'buzz']

  return (
    <EnabledFeatureFlagsContext.Provider
      value={{
        flags: flags.filter(flag => growthbook?.isOn(flag)),
      }}>
      {children}
    </EnabledFeatureFlagsContext.Provider>
  );
}
I'd like to wrap that in an
useMemo
but the only way that I see that would work is to do something with the
setRenderer
function to update some kind of context that I use here. But that seems a bit extreme, is there something that
useGrowthbook
returns that I can tie the
useMemo
to?