Skip to content

Instantly share code, notes, and snippets.

@gasserkl
Created September 8, 2021 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gasserkl/f1567725e60c9fcc4090439439f6aa70 to your computer and use it in GitHub Desktop.
Save gasserkl/f1567725e60c9fcc4090439439f6aa70 to your computer and use it in GitHub Desktop.
function setup(...args) {
const returnVal = {};
function ComponentHarness() {
// change the object referenced by returnVal, otherwise we would lose the reference in the outer scope and could not make assertions on the values returned by the hook
Object.assign(returnVal, myCustomHook(...args));
return null;
}
render(<ComponentHarness />);
return returnVal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment