Skip to content

Instantly share code, notes, and snippets.

View kikogamer's full-sized avatar
😄

Ronaldo Carneiro da Silva Filho kikogamer

😄
  • São Paulo
  • 18:34 (UTC -03:00)
View GitHub Profile
@kikogamer
kikogamer / Auth.jsx
Created November 11, 2020 17:10 — forked from EduVencovsky/Auth.jsx
Private Routes with Auth using react-router and Context API
import React, { useState, useEffect } from 'react'
import PropTypes from 'prop-types'
import { checkIsAuthenticated, authSignUp, authLogin, authLogout } from '../../services/auth'
export const AuthContext = React.createContext({})
export default function Auth({ children }) {
const [isAuthenticated, setIsAuthenticated] = useState(false)
const [isLoading, setIsLoading] = useState(true)