title: How do I update state of parent class where Ive defined contexAPI , when I submit a form in child component?
body: <p>How do I update state of the class where parent contex api is defined ,  when I submit form from a child component  ??</p>
  <pre><code>
  import React, {createContext,Component} from 'react'
  import http from './services/httpService'
  import {MyApiUrl} from './services/httpService'
  
  
  export const GlobalState = createContext()
  
  export class DataProvider extends Component{
  
      state={
          jobs:[],
          loadstate:false,
      }
  
      async populateCategories() {
        
              const {data:jobs}=await http.get(MyApiUrl+'/api/jobs')
              this.setState({jobs})
          
          
  console.log('hellow world')
  return
  
  }
  
        
  
      async componentDidMount(){
          await this.populateCategories()
         
      }
  
  
       logPokemon = this.populateCategories.bind(this); 
  
      // async  setUser() {
         
      //      await this.populateCategories()
      //   }
      
  
     
  
  render(){
      const {jobs}=this.state;
  
      const{logPokemon}=this
      const{children}=this.props
      return (
          &lt;GlobalState.Provider value={{logPokemon,jobs}}&gt;
              {children}
          &lt;/GlobalState.Provider&gt;
      )
  }
  
    
  }
  </code></pre>
  <p>now from another child component , when a form is submitted I did this , And I got a Warning: Can't perform a React state update on an unmounted component</p>
  <pre><code>static contextType = GlobalState
  
      const {logPokemon} = this.context;
      logPokemon()
  </code></pre>