Skip to content

Instantly share code, notes, and snippets.

@gaearon
Created November 1, 2018 10:08
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save gaearon/62866046e396f4de9b4827eae861ff19 to your computer and use it in GitHub Desktop.
Save gaearon/62866046e396f4de9b4827eae861ff19 to your computer and use it in GitHub Desktop.
Hooks implementation pseudocode by @jamiebuilds
// Originally written by @jamiebuilds
let hooks = null;
export function useHook() {
hooks.push(hookData);
}
function reactInternalRenderAComponentMethod(component) {
hooks = [];
component();
let hooksForThisComponent = hooks;
hooks = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment