Referenceerror: localstorage is not defined di reactjs

import React from 'react'
import axios from 'axios'

const axiosReq = axios.create()
const AuthStudentContext = React.createContext()

export class AuthStudentContextProvider extends React.Component {

	constructor() {
		super()
		this.state = {
			students: [],
			student: localStorage.getItem('student') || {},
			token: localStorage.getItem('token') || "",
			isLoggedIn: (localStorage.getItem('student' == null)) ? false : true
		}
	}

avatar tonisuwendi
@tonisuwendi

169 Kontribusi 36 Poin

Diperbarui 4 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban