Hijacking React Globals
Hi All! Wanted to post a tldr of our recent blog post about an interesting pattern we figured out to work around Reacy components without deploying to the actual code base.
Explanation: By overriding the MobileStickyCTA React Component, we pivot off of the incoming arg prop for `caption`, replace it if the caption in question is the one being tested, and then curry the call back using `origfn.apply` so we don’t lose any of the original functionality.
Hope this helps someone! I'm subscribed to the thread so ask away if you have any questions!
Optimizely's Conditional Activation makes this even easier, as you can check for variables or define functions like yours to make changes without deploying to your code base. You can then still use the Visual Editor to define the changes to be rendered.
Do you have any customer use cases you can share who are using this React strategy?
Solutions Architect | Optimizely, Inc.
We've used the global flag/pivot approach well, but find it requires too much of a coupling between product launch and test launch to be maintainable (part of being an agency).
We don't have any other use cases at the moment, but I'll respond back when we do!