How to use Amplify ?
Note:
The quickframe template uses the firebase authentication system by default.
-
Step-1 : Create an AWS account first if you don't already have one. After that, follow this documentation: https://docs.amplify.aws/lib/project-setup/prereq/q/platform/js/#configure-the-amplify-cli (opens in a new tab)
-
Step-2 : After completing amplify setup, Open the
src/hooks/useAuth.js
file. Thereupon, import the AuthContext fromsrc/contexts/amplifyContext
then pass it as an argument in the useContext hook. -
Step-3 : Call the useAuth hook inside AuthGuard, GuestGuard components, Login, Register page etc.
Step 2
_10import { AuthContext } from "contexts/amplifyContext";_10_10const useAuth = () => useContext(AuthContext);_10export default useAuth;
Step 3
How to delete from app ?
- Delete the
amplifyContext.jsx
file fromsrc/contexts
folder - If you use this, you should also remove the AuthContext file from the
src/hooks/useAuth.js
file. - Remove the
aws-exports.js
file &lify
folder from the app root folder as well. - Remove the dependency
aws-amplify