Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions learn/react-native/prefab-as-rn-component.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: "Reuse React Native Components Across Any App with WaveMaker"
id: "prefab-as-react-native-component"
sidebar_label: "Prefab as RN Component"
---
---

In today's fast-paced app development world, flexibility and reusability are game-changers. Instead of building an entire app from scratch, why not create small, reusable React Native components? With WaveMaker, you can build Prefabs—self-contained, customizable components—and integrate them into any application, even if it's not built with WaveMaker. This approach saves time, reduces redundancy, and keeps your codebase clean and modular.

## Why Use Reusable React Native Components?

Using reusable components makes development faster and more efficient. Whether you're working on multiple projects or maintaining a large-scale application, having a library of ready-to-use components ensures consistency and speeds up development. Plus, updating a component in one place means your changes can automatically reflect across all apps using it.

## How It Works

The process is straightforward and involves two main steps: setting up the Prefab in WaveMaker and integrating it into an external app.

### Building the Prefab in WaveMaker

1. **Create a Prefab**: Design a reusable React Native component with the necessary UI and logic.
2. **Configure Properties, Events, and Methods**: Define customizable properties, event handlers, and methods to make your component flexible.
3. **Export the Component**: Once it’s ready, export the Prefab as a ZIP package containing all required dependencies and configurations.

### Using the Prefab Outside WaveMaker

4. **Upload the Package**: Store the exported ZIP package in an npm registry, GitHub, or a local repository for easy sharing.
5. **Install the Prefab in an External App**: Use npm to add the Prefab as a dependency in your non-WaveMaker React Native app:
```bash
npm install <prefab-name>
```
6. **Import and Use the Prefab**: Add the Prefab to your React Native or Expo application like any other React Native component.

Binary file removed website/blog/documentation-full-page-reading-1.png
Binary file not shown.
Binary file removed website/blog/documentation-full-page-reading.png
Binary file not shown.
Binary file removed website/blog/rightnav-collapsed-1.png
Binary file not shown.
Binary file removed website/blog/rightnav-collapsed.png
Binary file not shown.