This is an application that lets users vote through the public Polls API.
The project uses:
- React Native for iOS & Android app development
- TypeScript for type-safety
- Redux for state management
- Sagas for managing side effects
- React Native Testing Library for testing the components
The aim of this project is to be used as a reference on how to:
- test and structure a
React Native+Reduxproject - use
TypeScriptandRedux-Sagain aReact Native+Reduxproject
| Pagination | Voting | Creating questions |
|---|---|---|
![]() |
![]() |
![]() |
The folder structure of the project looks as follows:
src
└── assets
└── components
└── navigation
└── screens
└── services
├── store
│ └── sagas
│ ├── selectors
│ └── slices
└── styles
└── test
└── types
└── App.tsx
Contains images used in the project. Other shared assets should be stored here (e.g. fonts, videos, etc.).
Contains reusable UI components.
Contains navigation related files (Navigators, NavBar, etc.).
Contains screens of the app. Each screen has dedicated folders for components and hooks.
Contains APIClient and APIHelpers. Other services should be stored here (e.g. localization, error tracking, etc.).
- sagas:
Sagasused for side effects ofRedux actions - selectors:
Selectorsto retrieve and compute derived data from theRedux state - slices:
Slicesof theRedux statewhich containactionsandreducers
Contains colors and other style values (icon sizes, spacings, etc.) used throughout the app.
Contains test related files (jest setup, mocks, etc.).
Contains the types used throughout the project.
For bigger projects I'd recommend creating separate folders for each feature. That way it's easier to navigate the project. Also, several developers can work on different features without having to worry too much about merge conflicts.
Example:
src
└── assets
└── components
└── navigation
└── services
├── features
│ └── login
│ | └── components
│ | ├── screens
│ | └── store
│ └── questions
│ | └── components
│ | ├── screens
│ | └── store
└── styles
└── test
└── types
└── App.tsx
Please, keep in mind that there are many other ways in which you can structure a React Native project. This is the approach that has worked for me. Feel free to adopt it either partially or fully and see if it fits your needs.
Install dependencies:
yarn
cd ios && pod install
Start packager:
yarn start
Run the app:
yarn ios
If you prefer Xcode rather than command line:
- open
./ios/PollsApp.xcworkspacein Xcode - select a simulator or a device
- hit the Run button
Have an Android emulator running (quickest way to get started), or a device connected
Run the app:
yarn android


