Solve your hook spaghetti (with more spaghetti). Inspired by React Forget.
MIT License
Bot releases are visible (Hide)
Published by lxsmnsyc about 1 year ago
$$ref
from $$cache
by @SukkaW in https://github.com/lxsmnsyc/forgetti/pull/30
useRef
for all, useRef
is only now used for refs, the rest uses useMemo
). This change is pretty much aligned to React's behavior e.g. Server Components support and proper cache management through useMemo
Full Changelog: https://github.com/lxsmnsyc/forgetti/compare/v0.6.2...v0.7.0
useRef
instead of useMemo
https://github.com/lxsmnsyc/forgetti/commit/e288b040b2c1580a3827c8680b1563472fa20455
useMemo
references in a scheduled way (think of LRU). useRef
doesn't have this kind of behavioroptimizeJSX
config https://github.com/lxsmnsyc/forgetti/pull/23/commits/27093b79fe00703685d811b8a8c60662427c18c8
runtime.memo
in the preset will automatically generate JSX optimizationPublished by lxsmnsyc over 1 year ago
This release adds a new optimization process on top of the current memoization process. Forgetti will now run the transform as follows:
Full Changelog: https://github.com/lxsmnsyc/forgetti/compare/v0.4.7...v0.5.0
Published by lxsmnsyc over 1 year ago
throw
statements https://github.com/lxsmnsyc/forgetti/commit/37c1d3c9d610f7da862bd970c60b21b1ac42e586
let
to be merged as a single declaration https://github.com/lxsmnsyc/forgetti/commit/5d224a4d36330819d6337582fcd0fd0c997da01d
useMemo
and useCallback
tracked dependencyFull Changelog: https://github.com/lxsmnsyc/forgetti/compare/v0.2.0...v0.3.0
Published by lxsmnsyc over 1 year ago
useRef
import { useRef } from 'react';
function Example(props) {
return useRef(props.value);
}
// Compiles into
import { useMemo as _useMemo } from "react";
import { useRef } from 'react';
function Example(props) {
let _c = _useMemo(() => new Array(1), []);
let _v = _c[0] || (_c[0] = {
current: props.value
});
return _v;
}
Full Changelog: https://github.com/lxsmnsyc/forgetti/compare/v0.1.1...v0.2.0