/auth-contextapi-hooks

Authentication on ReactJS / React Native with Context API and Hooks

Primary LanguageTypeScriptMIT LicenseMIT

Authentication with Context API and Hooks - ReactJS and React Native

License

Created following the tutorial of Rocketseat available on Youtube: # Autenticação no React Native / ReactJS com Context API & Hooks | Masterclass #12 by Diego Fernandes

Using that beatiful thing called Context API.

Create a custom hook for authentication.

context api, react native with context api, reactjs with context api,

  • When the page or app is closed and reopened a function on AuthContext will verify if have information stored and will rehydrate the user state then it will Sign In automatically, or Sign Out if no information was found.
Web Mobile
Showing auth feature on web application Showing auth feature on mobile application

Content


Installation and Usage

Clone

  • Clone this repo to your local machine using https://github.com/lucaswilliameufrasio/auth-contextapi-hooks.git
git clone https://github.com/lucaswilliameufrasio/auth-contextapi-hooks.git ./FOLDER_NAME

Setup

Web

Navigate to project's folder and install packages

$ cd FOLDER_NAME/web
$ yarn

Run the application with

$ yarn start

Open http://localhost:3000 on your favorite browser


Mobile

Navigate to project's folder and install packages

$ cd FOLDER_NAME/mobile
$ yarn

Run the application with

$ yarn android

Open another terminal window on mobile folder an run the metro bundler with

$ yarn start

FAQ

  • Why to use Context API instead of Redux?
    • When you don't need a time traveling debugger, as known as Redux DevTools, or custom middlewares.

Support

Reach out to me at one of the following places!

License