DEV Community

Discussion on: Step 1: Setting up React Native with Storybook

Collapse
 
marysue profile image
Mary Lark

In this tutorial, we redirect our root level index.js to storybook's index.js. But by doing this, we can no longer run the app when we're developing. We can only run storybook.

Is there some way we can fork inside index.js to either run the app, or run storybook in the emulator? Or for that matter, run the emulator by bypassing index.js and looking directly at storybook/index.js?

Collapse
 
ugglr profile image
Carl-W

I would suggest doing something like this in your entry file:

const useStorybook = {set this in some config file} <Boolean>

const App = () => useStorybook ? <Storybook /> : <Application />

AppRegistry.registerComponent(appName, () => App);

Enter fullscreen mode Exit fullscreen mode