Created
September 22, 2017 10:14
-
-
Save yogieputra8/b8980e91d1b117ce52b02d3636ba15f5 to your computer and use it in GitHub Desktop.
LocalStorage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentDidMount(){ | |
this.getToken() // Panggil function getToken | |
} | |
// Bikin function getToken | |
function getToken(){ | |
const token = localStorage.getItem('item') | |
console.log(token) | |
} |
componentDidMount(){
this.getToken() // Panggil function getToken
}
// Bikin function getToken
getToken = () => {
const token = localStorage.getItem('item')
console.log(token)
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Jangan bikin function didalam Lifecycle (DidMount, WillMount, dll) React, kepanjangan jadinya