Check out these branches to view the app with certain implemented features to learn about the topics described below.
-
extra-component-library-native-base: See how a component library is used in React Native. As an example the React Native (and Vue Native) component library NativeBase is used.- Example usage of NativeBase components.
- Relevant files:
CounterScreen.tsx
-
eject: View the project afterexpo ejectwas run.- Note the two new folders
ios/andandroid/which contain the nativeiOSandAndroidApps, respectively.
- Note the two new folders
Switch to the following branches for different state management implementations of the local state to display the numbers on CounterScreen.tsx, the photos on PhotosScreen.tsx and the favorites on FavoritesScreen.tsx:
-
react-context: Using React's build-in Context APIRelevant files:
- Both contexts are defined with default values in
src/context.ts. - Context values are implemented and wrapped around the entire navigation in
App.tsx.
- Both contexts are defined with default values in
-
vanilla-redux: Using Redux in it's pure form- All redux related code is inside the
src/storefolder.
- All redux related code is inside the
-
redux-toolkit: Using Redux withredux-toolkit- All redux related code is inside the
src/storefolder. - redux-toolkit uses a concept of slices which reduce the amount of necessary boiler
- All redux related code is inside the
-
redux-saga: Using Redux in it's pure form with redux-saga instead of redux-thunk for asynchronous actions.- The saga is implemented in
src/store/saga.ts. src/api/photos.tscontains an async function to fetch photos which is used inside the saga.redux-sagauses JavaScript generator functions (function*) and has some handy "effects" likeput(dispatches a Redux action) orcall(calls anything - a JS function, Promise or generator)- Redux saga is very powerful in implementing sophisticated asynchronous logic where execution of actions is dependent on others. The
takeLatesteffect (listens for a dispatched action) is used insidesrc/store/saga.ts.
- The saga is implemented in