Flags SDK Workshop

Embedding

This is only available in flags@canary

embed

  • How can we experiment on precomputed pages?
  • Experimentation provider SDKs on the client need to know the flag state and evaluation context
  • We can't make this payload part of the precomputed page, static page as it is user specific

The Flags SDK has no opinion on experimentation and A/B testing yet, but it provides tools to help.

  • embedBootstrapData(response, data): Response call this from Routing Middleware to embed data into the response
  • <FlagBootstrapData /> render this in a top-level layout, its contents will be replaced by embedBootstrapData
  • useBootstrapData() a hook which returns the data embedded by embedBootstrapData

embedding-flow