docs: add postgres and sqlocal instructions

This commit is contained in:
dswbx
2025-03-25 13:02:09 +01:00
parent 67e0374c04
commit ec015b7849
2 changed files with 65 additions and 15 deletions

View File

@@ -4,15 +4,12 @@
// there is no lifecycle or Hook in React that we can use to switch
// .current at the right timing."
// So we will have to make do with this "close enough" approach for now.
import { useEffect, useRef } from "react";
import { useLayoutEffect, useRef } from "react";
import { isDebug } from "core";
export const useEvent = <Fn>(fn: Fn | ((...args: any[]) => any) | undefined): Fn => {
const ref = useRef([fn, (...args) => ref[0](...args)]).current;
// Per Dan Abramov: useInsertionEffect executes marginally closer to the
// correct timing for ref synchronization than useLayoutEffect on React 18.
// See: https://github.com/facebook/react/pull/25881#issuecomment-1356244360
useEffect(() => {
ref[0] = fn;
}, []);
return ref[1];
export const useEvent = <Fn>(fn: Fn): Fn => {
if (isDebug()) {
console.warn("useEvent() is deprecated");
}
return fn;
};