https://www.growthbook.io/ logo
#give-feedback
Title
# give-feedback
b

busy-horse-73824

10/17/2022, 3:12 PM
Just to flag, there's some issues with how growthbook-react works, and how you document its use - due to it being mutable Running
growthbook.setFeatures
,
setAttributes
, etc do not trigger a re-render (because the context provider's value doesn't change), and there's nothing in the hooks etc to compensate for that Currently the only safe way to use growthbook with react is to treat the GrowthBook class as being immutable - any other way, it's fundamentally broken
So far we've used growthbook with react and go. Both have been written in quite broken ways. It seems like there was little understanding of the way Go and React work
I would also flag that the use of the word
subscribe
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
)
I'd suggest you may consider investing into improving the quality of the SDKs
f

future-teacher-7046

10/17/2022, 6:27 PM
Hi James, thanks for the feedback. Happy to meet to talk through your use case and see how we can improve the SDKs. •
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.
b

busy-horse-73824

10/18/2022, 12:25 PM
Ah I see, we did see the
setRenderer
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
11 Views