Hustler-Pixelwelt: Hochhaus zusammengesteckt (Welt mit Regie, Kopfzeile, Detailansicht), CSS-Importe, forwardRef im Mini-Läufer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c5074f4f6
commit
b4e67a43a2
7 files changed
+135
-27
No files matched your search
@@ -112,6 +112,13 @@ export function useEffect(fn, deps) {
|
||||
slot.cleanup = fn()
|
||||
})
|
||||
}
|
||||
// forwardRef: der ref kommt wie in React 18 als zweites Argument (der Mini-Läufer lässt ref in den props stehen)
|
||||
export function forwardRef(render) { return (props) => render(props, props.ref ?? null) }
|
||||
// useImperativeHandle: Objekt-Ref sofort beim Rendern setzen (wie React vor den Effekten), beim Abbau wieder null
|
||||
export function useImperativeHandle(ref, create) {
|
||||
if (ref && typeof ref === 'object') ref.current = create()
|
||||
useEffect(() => () => { if (ref && typeof ref === 'object') ref.current = null }, [ref])
|
||||
}
|
||||
`
|
||||
export const fakeReact = {
|
||||
name: 'fake-react',
|
||||
|
||||
Reference in new issue
Block a user