This is a boilerplate for Clean React Native architecture created by Factorial Complexity.
Clean React Native architecture projects are meant to be modular, reusable, testable and maintanable.
The project is built on React Native (no Expo). Regular React Native commands work. Xcode and Android Studio projects are included.
First, make sure to execute:
npm install
(NOTE: The project uses NPM not Yarn).
iOS project uses Cocoa Pods. Before starting, execute this in ios
directory:
pod install
You will need CocoaPods installed.
Clean React Native is a loose application of Clean Architecture ideas to React/Redux. Application is broken into 3 layers:
- data - contains the code for interacting with the outside world.
- presentation - screens, other components and navigation logic.
- domain - business logic of the application, including Redux state management (actions, reducers and selectors).
Ideally, domain layer is not aware of presentation and data, while the latter are aware of the former. This is not 100% true in real life, but is followed as much as possible.
The code is broken into "modules", bound together by wireframe.ts
. This approach simplifies writing unit tests as dependencies are easily tracked.