Skip to content

Instantly share code, notes, and snippets.

@MosesEsan
MosesEsan / auth_app_provider.js
Last active August 31, 2021 15:35
React Native Authentication App Context Provider
import React, {useMemo, useReducer, useContext} from 'react';
import {AsyncStorage} from "react-native";
import axios from "axios";
//IMPORT REDUCER, INITIAL STATE AND ACTION TYPES
import reducer, {initialState, LOGGED_IN, LOGGED_OUT} from "./reducer";
// CONFIG KEYS [Storage Keys]===================================
export const TOKEN_KEY = 'token';
export const USER_KEY = 'user';