I'm starting to use Hook and I have a problem to handling multiple useEffect
current Hooks code:
//1st useEffect should run only on DidMount
React.useEffect(()=>{
//Calling API only on didMount
},[])
//2st useEffect should run on Context value Changes
React.useEffect(()=>{
//Processing Context Foo and Context Bar on didMount and didUpdate
},[foo, bar])
My Expected Result is to add a loading while 2 useEffect is run on didMount
I can achieve it by using class Component like this
componentDidMount(){
this.setState({isLoading:true},()=>{
//Call API
//Processing Context Foo and Context Bar
//on CallAPI and Processing Context is done
this.setState({isLoading:false})
})
}
how can i achieve it using Hooks?