react-client-sdk icon indicating copy to clipboard operation
react-client-sdk copied to clipboard

feat: export LDProvider context to be able to use Launchdarkly with storybook

Open soupette opened this issue 6 months ago • 2 comments

Requirements

  • [X] I have added test coverage for new or changed functionality
  • [X] I have followed the repository's pull request submission guidelines
  • x ] I have validated my changes against all supported platform versions

Related issues

https://github.com/launchdarkly/react-client-sdk/issues/30

Describe the solution you've provided

This PR exports the react context provider used in the LDProvider component in order to support integration with storybook when using components that depends on the useFlags hook.

Why it is needed?

Well, component driven development and integration with storybook is a common practice however Launchdarkly does not export any MockProvider to be able to work storybook and mocking all requests with MSW can be bit too much. On the other side by exporting the react context developers can create their own storybook decorator to make LD working.

Describe alternatives you've considered

None

Additional context

Add any other context about the pull request here.

soupette avatar Jul 31 '24 12:07 soupette