Skip to content

Instantly share code, notes, and snippets.

View b3nab's full-sized avatar

Ben Abbenanti b3nab

View GitHub Profile
@b3nab
b3nab / React-Hooks.js
Created October 12, 2021 19:13 — forked from craigtaub/React-Hooks.js
Nested React Hooks
// Engine
const React = {
index: 0,
state: [],
useEffect: (callback, dependencies) => {
const cachedIndex = React.index;
const hasChanged = dependencies !== React.state[cachedIndex];
if (dependencies === undefined || hasChanged) {
callback();