worried-planet-2191
10/17/2022, 3:12 PMbusy-horse-73824
10/17/2022, 3:14 PMbusy-horse-73824
10/17/2022, 3:21 PMsubscribe on growthbook-react is risky. In React projects, this terminology would typically indicate it being a way to know when mutable fields change
Provided a screenshot of how code would typically be written to make use of this
But it actually seems to only be used in a very specific & entirely undocumented situation? (with run)busy-horse-73824
10/17/2022, 3:22 PMfuture-teacher-7046
growthbook.setFeatures and growthbook.setAttributes should cause the GrowthBookProvider to re-render. The context value doesn't change, but the Provider has an internal state that gets updated that should trigger a re-render. If that's not happening, it may be a bug that we can look into.
• growthbook.subscribe is an internal method with a very niche use case. I agree the naming isn't great there - one of the reasons we haven't added it our documentation.busy-horse-73824
10/18/2022, 12:25 PMsetRenderer thing (which we thought would be something we had to implement against), but thought in practice it probably wouldn't be the best approach
I would note that it won't work if you use the growthbook instance with multiple providers - might be worth making it subscription based, and then cases like ours can leverage that too