Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

Async Function not recognize in React.js Native ?

By M.K. Verma · 2 May 2022

Async Function not recognize in React.js Native ?

Try this way

class AppProvider extends React.Component {
  
  const functionOne = async (e) => {
    try {
      ....
    } catch (e) {
      ....
    }
  };
  
  const functionTwo = async (e) => {
    try {
      ....
    } catch (e) {
      ....
    }
  };

  render() {
    return (
      <AppContext.Provider
        value={{
          ....
          functionOne: this.functionOne,
          functionTwo: this.functionTwo,
        }}
      >
     {children}
     </AppContext.Provider>
    );
  }
}
export default AppProvider;