samedi 3 août 2019

How can i wrap an HOC around const export "function"

I have an HOC called withErrorHandler which takes a component and the axios it uses and it adds error handler to it, this is easy with normal components

export default withErrorHandler(myComponent, axios); 

But i don't know how to do the same when the export syntax and functions are like this :

//how can i wrap an hoc around this?
export const authenticationService = {
  login,
  logout
};

function login(username, password) {}

function logout() {}

Aucun commentaire:

Enregistrer un commentaire