Before starting
Content
First read about Redux and Redux ToolKit, about what it can do, what they offer and then come back here to move on.
It's important to know about them because they are core components of this template and knowing them can save your time and eliminate many questions.
If you don't want to use Redux
You can simply remove it with next following steps:
- Remove it from dependencies and devDependencies:
npm uninstall @reduxjs/toolkit react-redux redux-persist @types/react-redux
- Delete the
src/core/storefolder - Remove Redux usage from
registerNavigationComponent - Change
Splashscreen navigation component initialization:
From:
registerNavigationComponent(Pages.splash, Splash, true);
To:
registerNavigationComponent(Pages.splash, Splash);
- Remove usage of
useAppSelectorinSplash(but you have to manage nowOnboardinglogic your way):
export const Splash: NavigationFunctionComponent = () => {
useEffect(() => {
setTabsRoot();
}, []);
return <LoadingComponent />;
};
- Remove unneeded interfaces from
src/types/index.ts:
export interface RehydrateAppAction extends RehydrateAction {
payload?: RootState;
}
- Remove unneeded
handlePromiseResultfromsrc/common/validations/errorValidations.ts:
export function handlePromiseResult(
promiseAction: Promise<any>,
successMessage?: string,
successAction?: () => void,
processError?: (error: Error) => IErrorResult,
setError?: (errorMessage: string) => void,
) {
promiseAction
.then(unwrapResult)
.then(() => {
successMessage && showToast({text: successMessage});
successAction && successAction();
})
.catch((handledError: Error) => {
processError && handleErrorPostProcessing(processError(handledError), setError);
});
}
That's it, you successfully removed redux from project.