Export your components
  • 05 Mar 2024
  • 1 Minute to read
  • Dark
    Light
  • PDF

Export your components

  • Dark
    Light
  • PDF

Article summary

Exporting your React Native components

Your main component in a module must be exported from the index.js file with a default export.

Plain export

It can be a plain export such as: export default YourModuleMainComponentHere;

A plain export gets converted to the following object:

{
  title: "YourModuleMainComponentHere",
  navigator: YourModuleMainComponentHere
}

Explicit export

You can also export an explicit object that gives you control over the title, the entry point, the redux slice, and hook:

export default {
  title: "Your module title here",
  navigator: YourModuleMainComponentHereOrYourMainStackNavigator,
  slice: YourModuleReduxSliceHere,
  hook: YourAppInitCodeHere
}


Was this article helpful?